Forum Discussion

mariavalenv19's avatar
mariavalenv19
New Contributor II
2 years ago

VLookUP Table

Hi, 

I'm trying to look up values from a VLookUp table (previously made in the Transformation Rules) within a Complex Rule in my Data Source, MMomentoff how could I this? Thank you very much in advanced.

 

Best,

Nieves

  • Hi,

    You can use the function:

    BRApi.Utilities.TransformText(si, "LookupItem", "LookupGroupName", Boolean)

    where "lookupitem" is the item you wish to look up and the "lookupgroupname" is the name of the name of the lookup transformation group. the boolean determines how to handle in the event the lookup item is not found. (see the intellisense information in OS)

    If you will need to look up the same item repeatedly, you may want to consider using the global objects to store the results of previous lookups to avoid repeated calls of the BRAPI.

    Regards,

  • KarlT's avatar
    KarlT
    Contributor III

    Hi,

    You can use the function:

    BRApi.Utilities.TransformText(si, "LookupItem", "LookupGroupName", Boolean)

    where "lookupitem" is the item you wish to look up and the "lookupgroupname" is the name of the name of the lookup transformation group. the boolean determines how to handle in the event the lookup item is not found. (see the intellisense information in OS)

    If you will need to look up the same item repeatedly, you may want to consider using the global objects to store the results of previous lookups to avoid repeated calls of the BRAPI.

    Regards,

    • mariavalenv19's avatar
      mariavalenv19
      New Contributor II

      Hi Karl,

      This worked perfectly, now we're trying to figure out how to make an error message pop when there is no value in the table. Thank you very much! 

      Best Regards,

      Nieves

      • KarlT's avatar
        KarlT
        Contributor III

        Hi Nieves, Rather than throw an error I would try an "import>Workspace" type workflow so you can review the "untransformed" items after import and maybe prevent workspace completion if this list isn't empty.