Mapping-Table: Multiple SRC-Columns, wrong matches (multiple instead of one)

Hello everyone!

I have a mapping table with 3 “Source-Columns” and one Destination-Column. Column A, B, C are source, D is destination.

I use the element www.netiq.com/.../token-map.html with several “token-map-source-col” elements to customize it.

Example of the mapping table (not the whole one)

Bukrs Group Name Active
5555 LEADER Z 1
5555 LEADERSUB Z 1
5555 CORE Z 0
5555 SUB Z 0

Screenshot of the mapping table:

The token-map looks like this:

<do-set-local-variable name="lv.group.create" scope="policy">
				<arg-node-set>
					<token-map default-value="-1" dest="Active" source="Buchungskreis" table="..\..\customer_mapping-tables\mappingTableName" type="AND">
						<token-map-source-col name="Buchungskreis">
							<token-local-variable name="lv.o.bukrs"/>
						</token-map-source-col>
						<token-map-source-col name="GroupType">
							<token-local-variable name="lv.check.groupType"/>
						</token-map-source-col>
						<token-map-source-col name="OrgType">
							<token-local-variable name="lv.group.type"/>
						</token-map-source-col>
					</token-map>
				</arg-node-set>
			</do-set-local-variable>

Example from a trace file:

[12/06/24 15:42:36.715]:NULL_GROUPMANAGEMENT ST:    Applying rule 'create group - SUB'.
[12/06/24 15:42:36.715]:NULL_GROUPMANAGEMENT ST:      Action: do-set-local-variable("lv.check.groupType",scope="policy","SUB").
[12/06/24 15:42:36.715]:NULL_GROUPMANAGEMENT ST:        arg-string("SUB")
[12/06/24 15:42:36.715]:NULL_GROUPMANAGEMENT ST:          token-text("SUB")
[12/06/24 15:42:36.715]:NULL_GROUPMANAGEMENT ST:          Arg Value: "SUB".
[12/06/24 15:42:36.715]:NULL_GROUPMANAGEMENT ST:      Action: do-set-local-variable("lv.group.description",scope="policy","v "+token-local-variable("lv.group.name")).
[12/06/24 15:42:36.716]:NULL_GROUPMANAGEMENT ST:        arg-string("v "+token-local-variable("lv.group.name"))
[12/06/24 15:42:36.716]:NULL_GROUPMANAGEMENT ST:          token-text("v ")
[12/06/24 15:42:36.716]:NULL_GROUPMANAGEMENT ST:          token-local-variable("lv.group.name")
[12/06/24 15:42:36.716]:NULL_GROUPMANAGEMENT ST:            Token Value: "Customerdata".
[12/06/24 15:42:36.717]:NULL_GROUPMANAGEMENT ST:          Arg Value: "v customerdata".
[12/06/24 15:42:36.717]:NULL_GROUPMANAGEMENT ST:      Action: do-set-local-variable("lv.group.create",scope="policy",arg-node-set(token-map("..\..\customerMappingTable\customerMappingTable","Active",default-value="-1",source="Buchungskreis",type="AND",token-map-source-col("Buchun
gskreis",token-local-variable("lv.o.bukrs"))+token-map-source-col("GroupType",token-local-variable("lv.check.groupType"))+token-map-source-col("OrgType",token-local-variable("lv.group.type"))))).
[12/06/24 15:42:36.718]:NULL_GROUPMANAGEMENT ST:        arg-node-set(token-map("..\..\customerMappingTable\customerMappingTable","Active",default-value="-1",source="Buchungskreis",type="AND",token-map-source-col("Buchungskreis",token-local-variable("lv.o.bukrs"))+token-map-source
-col("GroupType",token-local-variable("lv.check.groupType"))+token-map-source-col("OrgType",token-local-variable("lv.group.type"))))
[12/06/24 15:42:36.719]:NULL_GROUPMANAGEMENT ST:          token-map("..\..\customerMappingTable\customerMappingTable","Active",default-value="-1",source="Buchungskreis",type="AND",token-map-source-col("Buchungskreis",token-local-variable("lv.o.bukrs"))+token-map-source-col("Group
Type",token-local-variable("lv.check.groupType"))+token-map-source-col("OrgType",token-local-variable("lv.group.type")))
[12/06/24 15:42:36.719]:NULL_GROUPMANAGEMENT ST:            token-map("..\..\customer_mapping-tables\customerMappingTable","Active",default-value="-1",source="Buchungskreis",type="AND",token-map-source-col("Buchungskreis",token-local-variable("lv.o.bukrs"))+token-map-source-col("Gro
upType",token-local-variable("lv.check.groupType"))+token-map-source-col("OrgType",token-local-variable("lv.group.type")))
[12/06/24 15:42:36.720]:NULL_GROUPMANAGEMENT ST:              token-map-source-col("Buchungskreis",token-local-variable("lv.o.bukrs"))
[12/06/24 15:42:36.721]:NULL_GROUPMANAGEMENT ST:                token-map-source-col("Buchungskreis",token-local-variable("lv.o.bukrs"))
[12/06/24 15:42:36.721]:NULL_GROUPMANAGEMENT ST:                  token-local-variable("lv.o.bukrs")
[12/06/24 15:42:36.721]:NULL_GROUPMANAGEMENT ST:                    Token Value: "5555".
[12/06/24 15:42:36.721]:NULL_GROUPMANAGEMENT ST:                  Arg Value: "5555".
[12/06/24 15:42:36.721]:NULL_GROUPMANAGEMENT ST:                Token Value: "[Buchungskreis, 5555]".
[12/06/24 15:42:36.722]:NULL_GROUPMANAGEMENT ST:              token-map-source-col("GroupType",token-local-variable("lv.check.groupType"))
[12/06/24 15:42:36.722]:NULL_GROUPMANAGEMENT ST:                token-map-source-col("GroupType",token-local-variable("lv.check.groupType"))
[12/06/24 15:42:36.722]:NULL_GROUPMANAGEMENT ST:                  token-local-variable("lv.check.groupType")
[12/06/24 15:42:36.722]:NULL_GROUPMANAGEMENT ST:                    Token Value: "SUB".
[12/06/24 15:42:36.723]:NULL_GROUPMANAGEMENT ST:                  Arg Value: "SUB".
[12/06/24 15:42:36.723]:NULL_GROUPMANAGEMENT ST:                Token Value: "[GroupType, SUB]".
[12/06/24 15:42:36.723]:NULL_GROUPMANAGEMENT ST:              token-map-source-col("OrgType",token-local-variable("lv.group.type"))
[12/06/24 15:42:36.723]:NULL_GROUPMANAGEMENT ST:                token-map-source-col("OrgType",token-local-variable("lv.group.type"))
[12/06/24 15:42:36.723]:NULL_GROUPMANAGEMENT ST:                  token-local-variable("lv.group.type")
[12/06/24 15:42:36.724]:NULL_GROUPMANAGEMENT ST:                    Token Value: "Z".
[12/06/24 15:42:36.724]:NULL_GROUPMANAGEMENT ST:                  Arg Value: "Z".
[12/06/24 15:42:36.724]:NULL_GROUPMANAGEMENT ST:                Token Value: "[OrgType, Z]".
[12/06/24 15:42:36.724]:NULL_GROUPMANAGEMENT ST:              Arg Value: "[Buchungskreis, 5555],[GroupType, SUB],[OrgType, Z]".
[12/06/24 15:42:36.724]:NULL_GROUPMANAGEMENT ST:          Token Value: {"1","0"}.
[12/06/24 15:42:36.725]:NULL_GROUPMANAGEMENT ST:          Arg Value: {"1","0"}.
[12/06/24 15:42:36.725]:NULL_GROUPMANAGEMENT ST:      Action: do-if().
[12/06/24 15:42:36.725]:NULL_GROUPMANAGEMENT ST:        Evaluating conditions.

Example "arg-value" for the search from the logs

Arg Value: "[Bukrs, 5555],[Group, SUB],[Name, Z]".

Result:

Arg Value: {"1","0"}.

Correct result should be only "0"

I defnied the variable as a nodeset, to see if I really get multiple matches and I don't know why I got multiple matches.

I also set the parameter 'type="AND">' on the "token-map" element with no success.

Does anyone has an idea why I got multiple matches? For me it seems likem that the matching in the mapping table is not working correctly.

IDM Version is 4.9

BR

Tobias

Edit: 09.12: Initials Post extended by further useful information.

  • 0  

    Show your Do-map token XML please?

  • 0   in reply to   

    Hello Geoffrey,

    I have generally revised the post with more information, I wrote this Friday afternoon in a hurry and later realized that the information content is quite poor. I also had to change some customer data.
     
    I'll try a few more checks today. For example, whether it queries “incorrectly”, i.e. whether it really only checks for the value itself or does a kind of “wildcard” search.

  • 0  

    I did a little bit of testing and I can tell, that there is something off with the return-values.I marked the results green (assumption based on the return values)


    If I know change the values  in "active", so that they are more 'unique' - then it seems to work correctly:


    For the moment, I will go with the last approach. At least for the time beeing and probably will also open a ticket.

  • Suggested Answer

    0   in reply to   

    You know, you might be hitting a 'feature' of the Map token most people don't know about!  Only place I ever saw it was in my book, and only because Shon told me about it.

    If you use a simple Src-Dest Map token, and say Src is GroupType=LEADER, you are going to get the first value as a string (I think) and ALL The values as a nodeset.

    This is super useful. 

    But what does that mean when two columns have multiple possible matches in a 2 column select case?  I suspect you are seeing the results.

    You can do this in XPATH if Map is not working, it is just slower.

    load your varibale XML into a nodeset variable called $lv.table

    then XPATH Of:

    $lv.table/mapping-table/row[col[1]=$lv.o.bukrs][col[2]=$lv.check.groupType][col[3]=$lv.group.type]/text()

    That will only work until you reorder the columns  There is a cleverer way to figure out the column names from col-defs but I am lazy and it is early in the morning here.

  • 0   in reply to   

    What I have observed is that if there are several matches and I also want the results from the several matches, then I would use a nodeset to have all the values here. For a result, I use the classic string.

    Sorry for the possibly stupid question. (I may also not understand the answer of you 100%)
    But I shouldn't even get into the case with “But what does that mean when two columns have multiple possible matches in a 2 column select case?”
    In my 3 column case, this combination is unique in the mapping table, so I should only get one result back either way.
    (either way, a bug ticket will be opened when the time comes)

    Thanks for the info with XPATH and the help with the problem in general! I will definitely make a note of this option with XPATH.

  • 0   in reply to   

    I think this is a bug. The nodeset should only return multiples if it macthes the criteria, so AND your three conditions.


    What I THINK is happening is when you use it as a nodeset you are getting a nodeset of answers from the first or maybe last condition. I suspect first.  Can you do a quick test, where there 3 distinctive answers for the same combo of three things.  See if you only get the first values or the last values.

  • 0  

    I do something similar in a couple of drivers, and for me it works. I mean it works that I use multiple columns to identify a cell.

    I might have understood the question wrongly.

    I created a table: 3 columns (lookup1, lookup2, result):

    <?xml version="1.0" encoding="UTF-8"?><mapping-table>
        <col-def name="lookup1" type="nocase"/>
        <col-def name="lookup2" type="nocase"/>
        <col-def name="result" type="nocase"/>
            <row>
            <col>lo1-1</col>
            <col>lo2-1</col>
            <col>result1</col>
        </row>
            <row>
            <col>lo1-2</col>
            <col>lo2-2</col>
            <col>result2</col>
        </row>
            <row>
            <col>lo1-3</col>
            <col>lo2-3</col>
            <col>result3</col>
        </row>
        <row>
            <col>lo1-4</col>
            <col>lo2-4</col>
            <col>result4</col>
        </row>
        <row>
            <col>lo1-5</col>
            <col>lo2-5</col>
            <col>result5</col>
        </row>
    </mapping-table>


    In my rule I have to local variables: lv1 = lo1-3 and lv2 = lo2-3, I would like to have them look up the row with result = result3

    <actions>
        <do-set-local-variable name="lv1" scope="policy">
            <arg-string>
                <token-text xml:space="preserve">lo1-3</token-text>
            </arg-string>
        </do-set-local-variable>
        <do-set-local-variable name="lv2" scope="policy">
            <arg-string>
                <token-text xml:space="preserve">lo2-3</token-text>
            </arg-string>
        </do-set-local-variable>
        <do-set-local-variable name="res1" scope="policy">
            <arg-string>
                <token-map default-value="NONE" dest="result" source="lookup1"
                    table="\[root]\system\driverset1\Test Driver\three-col-mappingtable">
                    <token-local-variable name="lv1" />
                    <token-map-source-col name="lookup2">
                        <token-local-variable name="lv2" />
                    </token-map-source-col>
                </token-map>
            </arg-string>
        </do-set-local-variable>
    </actions>


    Simulator tells me that it’s working:

    Test Driver :Applying policy: %+C%14CTESTPKG-sub-evt-Lookup2%-C.
    Test Driver :  Applying to add #1.
    Test Driver :    Evaluating selection criteria for rule 'Lookup by 2'.
    Test Driver :    Rule selected.
    Test Driver :    Applying rule 'Lookup by 2'.
    Test Driver :      Action: do-set-local-variable("lv1",scope="policy","lo1-3").
    Test Driver :        arg-string("lo1-3")
    Test Driver :          token-text("lo1-3")
    Test Driver :          Arg Value: "lo1-3".
    Test Driver :      Action: do-set-local-variable("lv2",scope="policy","lo2-3").
    Test Driver :        arg-string("lo2-3")
    Test Driver :          token-text("lo2-3")
    Test Driver :          Arg Value: "lo2-3".
    Test Driver :      Action: do-set-local-variable("res1",scope="policy",token-map("\[root]\system\driverset1\Test Driver\three-col-mappingtable","result",default-value="NONE",source="lookup1",token-local-variable("lv1")+token-map-source-col("lookup2",token-local-variable("lv2")))).
    Test Driver :        arg-string(token-map("\[root]\system\driverset1\Test Driver\three-col-mappingtable","result",default-value="NONE",source="lookup1",token-local-variable("lv1")+token-map-source-col("lookup2",token-local-variable("lv2"))))
    Test Driver :          token-map("\[root]\system\driverset1\Test Driver\three-col-mappingtable","result",default-value="NONE",source="lookup1",token-local-variable("lv1")+token-map-source-col("lookup2",token-local-variable("lv2")))
    Test Driver :            token-map("\[root]\system\driverset1\Test Driver\three-col-mappingtable","result",default-value="NONE",source="lookup1",token-local-variable("lv1")+token-map-source-col("lookup2",token-local-variable("lv2")))
    Test Driver :              token-local-variable("lv1")
    Test Driver :                Token Value: "lo1-3".
    Test Driver :              token-map-source-col("lookup2",token-local-variable("lv2"))
    Test Driver :                token-map-source-col("lookup2",token-local-variable("lv2"))
    Test Driver :                  token-local-variable("lv2")
    Test Driver :                    Token Value: "lo2-3".
    Test Driver :                  Arg Value: "lo2-3".
    Test Driver :                Token Value: "[lookup2, lo2-3]".
    Test Driver :              Arg Value: "lo1-3,[lookup2, lo2-3]".
    Test Driver :            Token Value: "result3".
    Test Driver :          Arg Value: "result3".


    The only difference I have is that after <token-map.. my first node is a local variable: <token-local-variable name="lv1" />, everything else is the same.

    It might work it might not.