Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Scripted date field searching issue


Recommended Posts

I've met a problem in scripted date field searching. I use the set field function in find mode to enter search criterias. It works perfectly well if I just enter a plain date there. The problem occur when I try to enter symbols like "


I tried to use DateToText calculation to make the whole string work as a text string, but the only thing that always happens is that the date field return a question mark [?].


I solved the problem by adding a calc field with DateToText[datefield], and perform the set field script step into that field instead. But that adds a new field every time you want a new searchable date field.


There has to be a simpler way.


Many thanks,



Link to comment
Share on other sites

One workaround is to have the text equivalent of the date string for which you you are searching placed in a global text field by the user. Then when the find in activated, set the actual date field to the global text field after "Enter Find Mode". This should work as I have often used it. It avoids the dreaded question mark


Be Well



Link to comment
Share on other sites

Hello Lazer,

The reason you are getting invalid results is that the Set Field[ ] command forces the data type to correspond to the type of the targetted field. When symbols are included, the value is no longer recognisable as a valid date, so Set Field[ ] is not able to place it into a Date field.


The solution is to use the command Insert Calculated Result[ ] instead, as it casts data type according to the first expression in the formula you provide, without reference to the data type of the target field. Thus, for example:


Insert Calculated Result [YourDateField", " "1/12/2003...5/12/2003" "]


will succeed where 'Set Field [YourDateField", " "1/12/2003...5/12/2003" "]' fails. wink.gif

Link to comment
Share on other sites

Thanks again Ray!


I never knew what to use "Insert calculated result" for. Now I know. But why do you need "Set Field" function then?

Well you don't have to answere, you solved my problem!!



Link to comment
Share on other sites

Ray is correct in what he says.


The only gotcha that you have to watch out for with the Insert Calculated Result script step is that, like the Paste script step, you must be on a layout that has the field on it for it to work.


That is why we use Set Field more often - there is not the requirement for access to the field.


However, as Ray has said, Set Field does not work for your requirements here.

Link to comment
Share on other sites

  • Create New...

Important Information

Terms of Use