04-10-2023 03:59 AM - last edited on 05-03-2023 08:53 AM by JackLacava
Hi,
ParamA will be a multiselect combo box and the same should be passed to business rule as well.
May I know how it can be done? I'm passing the parameter in calculate button, then DM step and then to BR.
Calc button : {seq_name}{ParamCC = |!ParamA!|}
DM step: {|!ParamCC!|}
BR: Get value of ParamCC
Need suggestion on how should it be passed if parameter is multiselect.
thanks
Solved! Go to Solution.
04-10-2023 04:11 AM
Hi.
You can split the string in the receiving business rule by delimiter e g comma
Dim split as String() = args.NameValuePairs.XFGetValue("ParamCC").Split(",")
Then loop through rresults to get each selection e.g
For Each param As string in split
' Do Something
Next
04-10-2023 04:11 AM
Hi.
You can split the string in the receiving business rule by delimiter e g comma
Dim split as String() = args.NameValuePairs.XFGetValue("ParamCC").Split(",")
Then loop through rresults to get each selection e.g
For Each param As string in split
' Do Something
Next
04-10-2023 12:30 PM - edited 04-10-2023 12:51 PM
Thanks Seburn.I tried the suggestions provided and it works partially.Means when list of members were passed in ParamCC, it works only for the first parameter.
Dim split as String() = args.customcalculateargs.NameValuePairs.XFGetValue("ParamCC").Split(",")
For Each param As string in split
api.logmessage(param ) ( Im able to print each param)
' Do Something (but it works only for first parameter passed)
Next
04-10-2023 03:19 PM
OK. I think you need to check you are passing in the param value via button AND DM step with square brackets around the parameter (see above). This behavior sounds like you are only picking up the first comma separated value square brackets should fix 🙂
E.g button
seq_name}{ParamCC=[|!ParamA!|]}
E.g DM step
ParamCC=[|!ParamA!|]
04-10-2023 03:22 PM
E.g button
{seq_name}{ParamCC=[|!ParamA!|]}
E.g DM step
ParamCC=[|!ParamA!|]
04-10-2023 10:48 PM
It is due to space created for each member.Resolved using below line and it worked.
Dim ParamCC as string = (args.customcalculateargs.NameValuePairs.XFGetValue("ParamCC")).Replace(" ","")
Dim split as String() = ParamCC.Split(",")
For Each param As string in split
api.logmessage(param ) ( Im able to print each param)
' Do Something (but it works only for first parameter passed)
Next
Thanks
04-10-2023 11:24 PM - edited 04-10-2023 11:27 PM
Might be worth looking at String.Trim. Seems more appropriate and safer even if you don't 'expect' spaces in the middle of things.
Edit: I misread above and assumed you were taking off the spaces after you pulled it apart with the comma split which you weren't. But maybe you should be?
04-11-2023 06:57 AM
You can use linq and stringhelper to remove whitespace from each entry in the array before you loop e.g
Dim split as String() = args.NameValuePairs.XFGetValue("ParamCC").Split(",").Select(Function(x) StringHelper.RemoveWhitespace(x)).ToArray()
04-10-2023 05:12 AM
P.s. make sure to put square brackets around the parameter passed in via button to pick up all comma separated values e.g
{seq_name}{ParamCC=[|!ParamA!|]}