Hi,
what’s the correct sintax for writing a method that searches records between a date interval (e.g. all the order of 2002)?
If I use the form “1-01-2002…31-12-2002”, it works in a manual search, but not in a method.
What am I missing?
Hi,
what’s the correct sintax for writing a method that searches records between a date interval (e.g. all the order of 2002)?
If I use the form “1-01-2002…31-12-2002”, it works in a manual search, but not in a method.
What am I missing?
try this…
myDate = ‘01-04-02…31-04-03|dd-mm-yy’
OR
myDate = ‘04-01-02…04-31-03|mm-dd-yy’
etc..
note: Make sure that the format matches the format that’s
used in the column your performing the search on.
I’m not sure, but I’ll check if this is in the manual already.
maarten:
try this…myDate = ‘01-04-02…31-04-03|dd-mm-yy’
OR
myDate = ‘04-01-02…04-31-03|mm-dd-yy’
etc..
It works . Strangely, I had to write
data = “1-01-2003…31-12-2003|dd-MM-yy”
because using “1-01-2003…31-12-2003|dd-mm-yy” found only the records of january…
Thanks
Since I’m playing with dates, today I tried another way: I tried to use the SelectDialog to provide a list of the years to search in.
After half an hour of failures, I looked for an example in CRM solution and I realized that the syntax described in the help file is quite different.
Using CRM guideline, I made it work.
But I have a little problem: since the syntax uses the ’ character to separate Dialog items, how can I use that character (very common in italian) inside a string?
I tried to enclose it between " or , but it doesn’t seem to work
The method is:
var sceltannata = “”
var sceltannata = plugins.dialogs.showSelectDialog(‘Seleziona annata’,‘RICERCA ANNATA MORNINGER\n\nSeleziona annata’,
‘1993’,‘1994’,‘1995’,‘1996’,‘1997’,‘1998’,‘1999’,‘2000’,‘2001’,‘2002’,‘2003’)
controller.find()
data = “1-01-” + sceltannata + “…31-12-” + sceltannata +“|dd-MM-yy”
controller.search()
forms.elenco.controller.show()
Hi Ricardo,
Sorry about the “mm” / slip of the finger
This is used for minutes. MM is for month.
But I have a little problem: since the syntax uses the ’ character to separate Dialog items, how can I use that character (very common in italian) inside a string?
I tried to enclose it between " or , but it doesn’t seem to work
Instead of doing this > plugins.dialogs.showSelectDialog(‘Alert’,‘there**’**s a problem here’)
(bold single quote creates syntax error)
do this >plugins.dialogs.showSelectDialog(“Alert”,“there’s a problem here”)
This should work(as well as escaping ), although I understand from your words , you’ve already tried this. Does the Method editor warns you, when you try to save the script , or does the script itself runs incorrect?
The method is:
var sceltannata = “”
var sceltannata = plugins.dialogs.showSelectDialog(‘Seleziona annata’,‘RICERCA ANNATA MORNINGER\n\nSeleziona annata’,
‘1993’,‘1994’,‘1995’,‘1996’,‘1997’,‘1998’,‘1999’,‘2000’,‘2001’,‘2002’,‘2003’)
controller.find()
data = “1-01-” + sceltannata + “…31-12-” + sceltannata +“|dd-MM-yy”
controller.search()
forms.elenco.controller.show()
This should work fine.
(btw: I don’t see any single quotes in these text strings))
I’ve run next code succesfully as a test.
var year = plugins.dialogs.showDialog(“Alert”, “Let’s choose a year”,“2001”,“2002”,“2003”)
controller.find()
date_followup = “1-01-” + year + “…31-05-”+ year + “|dd-MM-yyyy”
controller.search()
Hope this helps.
maarten:
Hi Ricardo,Instead of doing this > plugins.dialogs.showSelectDialog(‘Alert’,‘there**’**s a problem here’)
(bold single quote creates syntax error)
do this >plugins.dialogs.showSelectDialog(“Alert”,“there’s a problem here”)This should work(as well as escaping ), although I understand from your words , you’ve already tried this. Does the Method editor warns you, when you try to save the script , or does the script itself runs incorrect?
It warned me during save. But, probably, I was making some mistake, because I tried this morning with this script:
var sceltannata = “”
var sceltannata = plugins.dialogs.showSelectDialog(“Attenzione”,“Scegli l’anno”,
“1993”,“1994”,“1995”,“1996”,“1997”,“1998”,“1999”,“2000”,“2001”,“2002”,“2003”)
controller.find()
data = “1-01-” + sceltannata + “…31-12-” + sceltannata +“|dd-MM-yy”
controller.search()
forms.elenco.controller.show()
and it works fine
BTW: why the Find&Replace function in Method Editor doesn’t work with ’ and " character?
Hi Ricardo,
I’ve checked the find/replace in the build that we’re about to release, and it works fine there. Let me know if this problem still occurs after installing new build.