I have a procedure which uses a loop to compile a text array of dates, based on the lowest and highest dates in a database date field. When there are many other dates between those two dates, the numeric dates are treated as text and the result is a workable text array.
If, however, the lowest and highest dates are the same (not uncommon if I’m considering only the year value), the array comprises only one element. A subsequent
arraystrip( function will then fail with the error message that the first parameter must be text. Many other functions would also fail.
To overcome this, I have had to use the
str( function in a couple of locations where it might not normally be seen to be necessary. For example, the following code fails if the two
str( functions are not employed:
local LowField, HighField, DateMode, NewDate, mfgFieldsArray field «Date of transaction» sortup firstrecord LowField = month1st(«Date of transaction») lastrecord HighField = month1st(monthmath(«Date of transaction»,1)) - 1 removesummaries 7 ; Compile an array of all possible dates between low and high dates mfgFieldsArray = str(LowField) ; str( function NewDate = LowField loop NewDate = monthmath(NewDate,12) stoploopif NewDate > HighField mfgFieldsArray = mfgFieldsArray + cr() + str(NewDate) ; str( function while forever message mfgFieldsArray arraystrip mfgFieldsArray,cr() message mfgFieldsArray
Panorama X is very clever in interpreting numeric input as text when putting an array together but it has this interesting and possibly bothersome side effect.
If I’ve got it all confused yet again, Dave T will surely deliver me yet another of his (always welcome) stern tutorials.