Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a piece of Macro which is used in a Button to select the PossibleValues for a Field/List Box. For example, data set is like this below:
ID | Region |
100 | A |
100 | B |
100 | C |
200 | D |
200 | E |
300 | F |
SUB SelectValues
SET Doc = ActiveDocument
fieldName = "Region"
'SET Field = Doc.Fields(fieldName).GetPossibleValues
Doc.Fields(fieldName).SELECT "*"
end SUB
=Concat(GetFieldSelections(Key), ',')
I see a '*' , instead of A, B, C.
Requirement:
How can I see the values in a Variable or Text Object as A, B, C and NOT '*' ?
Is there any other way to pass the Possible Values from a List Box to Variable?
Please help.
Regards!
Hi,
try to use concat(distinct Region, ',') instead of GetFieldSelections.
Cheers,
Patric
Hi,
try to use concat(distinct Region, ',') instead of GetFieldSelections.
Cheers,
Patric
getfieldselections() can actually take a few more parameters including one that will define 'maxvalues'.
Try entering a larger number like this:
GetFieldSelections(Key,'',100)
You can also 2x check the user preferences->general->'max values for current selections' setting
---------------------------
getfieldselections ( FieldName [, ValueSep [, MaxValues [, State]]])
Returns a string with the current selections in a field. It is possible to query an alternate state.
ValueSep is the separator to be put between field values. The default is ', '.
Maxvalues is the maximum number of field values to be individually listed. When a larger number of values is selected the format 'x of y values' will be used instead. The default is 6.
State is the alternate state to query.
The string that is returned can be in these forms:
'x, y,z' | If the number of selected values is Maxvalues or less, the string returned is a list of the selected values, separated with Valuesep as delimiter. |
'NOT x, y, z' | If the number of non-selected values is Maxvalues or less, the string returned is a list of the non-selected values, separated with ValueSep as delimiter, and NOT as a prefix. |
'x of y' | If the number of selected values is more than Maxvalues, but less than the total number of values (y) less Maxvalues. |
'ALL' | If all values are selected. |
'-' | If no value is selected. |
<search string> | If you have selected using search, the search string is returned. |
Examples
getfieldselections ( Year )
getfieldselections ( Year, '; ' )
getfieldselections ( Year, '; ' , 10 )