
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to get a list of possible values for a field
I need to check an existence of previous date for date in a chart for whole current selection.
As "exists" doesn't exist for a chart. I can use match() function only, like:
=match(MyDate - 1, MyDatePossibleListStr)For MATCH function, the second parameter should be a comma separated string.
Right now I'm using a macro to generate the string from field values:
sub GetPossibleDatesStr
set fld=ActiveDocument.Fields("dmNumDateHour")
set var=ActiveDocument.GetVariable("vPossibleDates")
dim str
set val = fld.GetPossibleValues(20000)
'msgbox(val.Count)
for i=0 to val.Count-1
str = str + CStr(val.Item(i).Number) + ","
next
' msgbox str
var.setContent str, true
end sub
In onAnySelect trigger I call the macro to populate the variable vPossibleDates with possible dates.
After that, my match() function looks like this:
=match(MyDate - 1, '$(vPossibleDates )')
Everything works fine, but tooooooo slow.
Maybe somebody knows another way to implement the logic or maybe there is a way to avoid the macro???

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The concat() function should return a comma separated list of possible values:
=concat(FIELD)
For you, try:
=match(MyDate - 1, concat(DATE_FIELD))


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Concat didn't work directly, I believe because we're creating a single string field with all the dates in it, not a literal piece of code inserted into the match() function. Dollar sign expansion fixes that, though:
match(MyDate-1,$(=concat(num(dmNumDateHour),',')))
That's definitely better than executing a macro, but perhaps we can do better still. For instance, it might be worth creating a DayBeforeMyDate field and using set analysis. Not sure if it'd be faster or slower.
count({<DayBeforeMyDate={'$(=concat(dmNumDateHour,chr(39)&','&chr(39)))'}>} MyDate)
I'm also thinking there might be a way to take advantage of the P() notation in set analysis, some sort of way of saying that DayBeforeMyDate is in the set of possible values of dmNumDateHour, but a solution so far eludes me.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is what I need in my dashboard:
or=count({<DayBeforeMyDate=E(MyDate)>} MyDate)
=<any group function>({<DayBeforeMyDate=E(MyDate)>} <some value>)
John, thank you for the bell about P/E functions in set analysis
