11-01-2022 05:55 PM - edited 11-01-2022 05:55 PM
When building a Data Source bound to a Connector business rule, if a need arises to use a Complex Expression, and that expression requires referencing several unbound fields, what is the proper statement to use to retrieve those field values in the expression?
I had been told to use the args.Line.Split function. For example, if I needed the Entity field in the data set, and Entity was the 10th field in the list, the expression would be: Dim entity As String = args.Line.Split(",")(9)
The "9" is used instead of "10" because the zero-base index.
I'm finding this args.Line.Split statement does not work properly if the field value contains a comma. The field imports correctly into the data set, but the args.Line.Split statement cannot differentiate a comma delimiter from one embedded in the field value and it ends up returning the wrong field.
Is there another statement that can be used in Connector based Data Sources to reference fields in complex expressions?
11-02-2022 11:18 AM
Technically the separator is ", " (comma and space), so maybe try that. Obviously this doesn't solve the problem if your value contains that same string. Generally speaking, when you drop on args.Line it becomes hack-territory, so chances that things will break somewhere are high.
An alternative approach could be to map that extra field to a spare UD (if you have it), so you can reference it in a Conditional Rule from the transformation rule of the dimension you're writing the expression for; all the UD values could then transform to None with a wildcard mask.
11-02-2022 11:27 AM
Thank you @JackLacava, you've confirmed my suspicions. In my case, it sounds like I need to either move the work done in the complex expressions to the Connector rule itself, or "cleanse" the data in the Connector rule to remove the commas to avoid the parsing corruption. Just as an fyi, I can't use UD's because the data being imported is for TXM so it's being imported into attributes. Thanks so much!