04-14-2022 06:15 PM - last edited on 05-02-2023 10:50 AM by JackLacava
We are trying to develop logic to do the following during transformation:
If the G/L account in the load is in a certain range and the UD2 member is valid, load to that intersection
otherwise
If the G/L account in the load is in that same range but the UD2 member is invalid, map UD2 to None
Has anyone gotten something similar to work?
Thanks,
Bil
04-16-2022 03:16 AM - edited 04-16-2022 04:26 AM
Give this a try with Conditional BR
1. Create a conditional business rule and do something like this
Dim account As Integer = args.GetSource("Ac#").XFConvertToInt
Dim ud2 As String = args.GetSource("U2#")
If account >= 1000 And account <= 2000 Then
If ud2 = "valid" Then 'check for valid U2#
Return ud2
Else
Return "None"
End If
Else
Return ud2
End If
2. Attach this BR to your UD2 Transformation
04-19-2022 06:04 AM
Just to add to the answer already posted, if you need to lookup whether the incoming UD2 string is a valid member in the target UD2 dimension, please avoid using BRAPI functions (like BRAPI.Finance.Members.GetMember ) in BRs like this since each call to a BRAPI function creates and destroys a database connection object from the DB connection pool, which is quite inefficient. You can make this more efficient by storing a list of valid members in memory , and caching it in BRGlobals, so it doesn't have to use BRAPI lookup functions every time. Below example for illustration purposes...
04-21-2022 02:59 PM
Thank you - this is very helpful. Do you know if the list of members can be logged for review?
Thanks
Bil