Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
Where the variables have the following values:
vItemOpts = 'fieldname1;fieldname2;fieldname3'
vCurrOpt = 2
This expression in a text object returns the string 'fieldname2'
=SubField(vItemOpts, ';', vCurrOpt)
and where the field 'fieldname2' is used in a list box and has 1 value selected, this returns the value 1
=GetSelectedCount(fieldname2)
but this combination of the two returns null:
=GetSelectedCount(SubField(vItemOpts, ';', vCurrOpt))
Is this because GetSelectedCount sees the string 'SubField....' as a fieldname? How can I get around this?
Regards,
Gordon
I think John's on the right track. You just need to add some indirection using another variable.
SET vItemOpts = 'fieldname1;fieldname2;fieldname3';
SET vCurrOpt = 2;
SET vField = "=SubField(vItemOpts, ';', vCurrOpt)";
and then use the expression:
=GetSelectedCount($(vField))
-Rob
Subfield() returns a string, so your expression probably gets evaluated like this:
=GetSelectedCount(SubField(vItemOpts, ';', vCurrOpt))
=GetSelectedCount('fieldname2')
=null (because you can't get selections for a string, only for a field, and it doesn't recognize it as a field)
I'm not thinking of how to tell it that you mean a field name instead of a string, assuming I even have the problem correct. There's got to be a way, though. Maybe something with dollar sign expansions, variables, or who knows what.
I think John's on the right track. You just need to add some indirection using another variable.
SET vItemOpts = 'fieldname1;fieldname2;fieldname3';
SET vCurrOpt = 2;
SET vField = "=SubField(vItemOpts, ';', vCurrOpt)";
and then use the expression:
=GetSelectedCount($(vField))
-Rob
Thanks Rob, John - that cracked it!
Regards,
Gordon