Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I use this function to get the 2nd selected value of field [Comp Name]
subfield(GetFieldSelections([Comp Name]),',',2)
I'd like to sum 'Amount' only of 2nd selected value, so I wrote this expression using set analysis:
sum({<[Comp Name]={'$(=SubField(GetFieldSelections([Comp Name]) ,',',2))'}>} Amount)
but it doesn't work
Same function with first selected value seems to work fine, I can't understand why
sum({<[Comp Name]={'$(=SubField(GetFieldSelections([Comp Name]) ,',',1))'}>} Amount)
I also tried to create a variable $(vSelComp2) that contains function subfield(GetFieldSelections([Comp Name]),',',2)
to use in this expression:
Sum({<
[Comp Name]={$(vSelComp2)}
>} Amount)
and it doesn't work either.
I need to sum amount of 2nd, 3rd, ... selected value only, but I can't get this to work. Any help would be appreciated.
Thanks in advance,
Jose
Try this
Sum({<[Comp Name]={"$(=SubField(GetFieldSelections([Comp Name], '@'), '@', 2))"}>} Amount)
The issue was that your Comp Name included comma in the name which confused the SubField function. In order to fix this, I changed the delimiter for GetFieldSelections to @ (you can change this to anything which won't occur in the Comp Name field) and then used SubField with @.
HTH
Best,
Sunny
Would you be able to share a sample which shows the issue?
Sure. I did this sample .qvf, hope it helps. You need to select (at least) 2 companies at Comp Name filter.
Thank you!
Try this
Sum({<[Comp Name]={"$(=SubField(GetFieldSelections([Comp Name], '@'), '@', 2))"}>} Amount)
The issue was that your Comp Name included comma in the name which confused the SubField function. In order to fix this, I changed the delimiter for GetFieldSelections to @ (you can change this to anything which won't occur in the Comp Name field) and then used SubField with @.
HTH
Best,
Sunny
Works great now. Thank you very much Sunny!
Best regards,
Jose.