I am currently trying to setup a prompt to set the Pickup Minutes for pickup orders.
I have a script that gets the Total amount of orders in the system already, how much the ticket total is, and will return a recommended/reference time.
Emre has mentioned in the post below that the error “initialization of devexpress.xpf.editors.textedit threw an exception” is from a syntax error in the regular expression
I’m assuming that the error comes from the colon.
I have tried:
[?How many minutes? “{LOCAL SETTING:refTime}”;([1-9]|[1-9][0-9]);;CON;]
[?How many minutes? ‘{LOCAL SETTING:refTime}’;([1-9]|[1-9][0-9]);;CON;]
[?How many minutes? {LOCAL SETTING(: )refTime};([1-9]|[1-9][0-9]);;CON;] (I put a space after the colon…because… smiley face )
So, if you need to pass your prompt value and some setting to a script, it’d be better to pass them as separate parameters e.g. {CALL:script.test('{LOCAL SETTING:refTime}','[?How many minutes?;\d{1,};;OCN]')}
Hmm, well the things is I would like to have the {CALL} inside of the prompt so it displays a reference time, that way the servers can easily tell the customers how long until order is ready, instead of asking the chefs how long each time.
To do that I would need to have the {CALL:x} or a {LOCAL SETTING:x} inside of the [?Prompt], unless there was an easier way of doing that, and I’m making things harder for myself…?
Colons does not break the prompt…at least in the default values section. I use Local Settings and Reports all the time and it doesn’t mess with the prompt. What usually does mess with prompt’s is square brackets [ ] in the default values section. I don’t know if you are trying to call something that has square brackets or not.
I’m not sure if the 2nd question mark would have any effect. Try removing it for now, to make sure that isn’t interfering with anything.
Call a script and put the ask question inside the script with the script returning the entered earlier.
You can build the string for the question within the script.
dlg.EditValue()
There are limits to some expressions when compounding, sometimes it won’t work as inner expression not parsed other times characters can mess up the syntax.
Use call to run a script, render your question string in the script so its a single var and use the dlg helper to put your ?prompt within the script. And the script return the entered value back to the action the script origiknally called.
So the extra question mark isn’t the problem. It seems to be the braces within the prompt text. I get a crash with just [?{SETTING:SOMESETTING}].
Anyhoo, here’s a script for the time being:
//{CALL:promiseTime.prompt('{LOCAL SETTING:refTime}')}
function prompt(refTime)
{
var r = dlg.EditValue("How many minutes? " + refTime + ";[0-9]*[1-9][0-9]*;;OCN","");
return r;
}
place this in ‘Minutes’: {CALL:time.prompt('{LOCAL SETTING:refTime}')}
The prompt will allow any positive, non-zero integer.