Forum Discussion

Beeswing77's avatar
Beeswing77
New Contributor III
6 months ago

Complex Expression in Transformation Rule - How to exit rule?

So we have a UD2 mapping set up in the List section.

What I want is to be able to set up a Complex Expression in the UD2 Composite section so that for certain accounts it does nothing and so moves on to the List section, but for everything else we have a hard coded UD2 (e.g. None).

I have no problem with setting the criteria in the Complex Expression, but I don't know if it is even possible to write some code that forces it to skip on out and look at the List mappings?

I realise this is maybe a bit back to front compared to how the Composite mappings work, but we have a very tight list of accounts where we need to do the List UD2 mapping,  and everything else (which can be any other account) should just go to None.

  • FredLucas's avatar
    FredLucas
    Contributor III

    Hi Beeswing77,

    Just to add to what Henning explains above.

    It sounds like you might be looking for a Mask type rule that maps all accounts that have not been mapped through your other mappings to None.

    It should look something like this:

    • Beeswing77's avatar
      Beeswing77
      New Contributor III

      We already have that mask in place.  However,  I don't want just any accounts having UD2's applied by the List mappings,  only some.  If I just leave the List mapping in place for all accounts we could potentially get UD2 info on accounts where we don't want it.

  • Henning's avatar
    Henning
    Valued Contributor II

    Hi, whatever is not covered through your Rule Expression in the Composite mapping is then mapped by List, Range or Mask mappings. So as long as your composite filter does not include the account members you wish to map via List or Map, this should work.

    • Beeswing77's avatar
      Beeswing77
      New Contributor III

      The composite filter captures quite a wide range of accounts.  I can't see any way to refine this filter without some kind of 'Not like' function.

      I can do way more robust filtering in the Complex Expression,  but by that point I can't find a way to go back out and try the next mapping type (i.e., List)

      • Henning's avatar
        Henning
        Valued Contributor II

        The Complex Expression will run through all members that are within the filter of your Composite mapping. This means that even if you get a function that says within your complex expression "when account = xyz, then move to list", it does not give you much of a benefit over just mapping this member in the complex expression as well since it is already being checked.

        Here is a post on IdeaStream asking to add something along the lines you are asking here for if I understand you correctly. Consider leaving a kudo to support this request if you agree:

        JIRA Ticket: PF-21104 (onestreamsoftware.com)

        (unless this has been added in the meantime and I missed it)

  • jwagner's avatar
    jwagner
    New Contributor III

    If you have a specified list of accounts you would like to be skipped in the Composite rule, you could use 'Globals.Bypass = True' in your rule, pseudocode below.

     

    Dim accountsToSkip As List(Of String) = {<accounts to skip here>}
    Dim sAccount As String = args.Value
    
    If accountsToSkip.Contains(sAccount) Then
         Globals.Bypass = True
    Else
    	<Composite Rule logic>
    End If

     

    • Beeswing77's avatar
      Beeswing77
      New Contributor III

      That sounds like what I want, but I can't seem to get it to work for me.  This is what I have now:

      If args.GetTarget("A#") = "BS11200"
      Globals.Bypass = True
      Else
      Return "None"
      End If

      It just returns 0's in UD2 for account BS11200

      • jwagner's avatar
        jwagner
        New Contributor III

        Couldn't you just shift the list logic into the Complex Expression?