Just wondering , could you add a prompt for input that asks the user to “enter a date” and then return what ever records have that date in a field eg “arrival_date”.
The prompt would simply be “enter search date” and then the returned records would be what ever records match that date.
Or is there something like a date picker that the prompt could use?
Any info/tips gratefully received!
Cheers Jon
The Prompter class does not support a date picker. But you could just ask for the date to be entered in as text then use the Date.parse(dateString)
function to parse a string into a date.
Thanks Brendan, I’ll have an experiment with that. Cheers.
I have a little prompter helper library that makes it easier to use the Prompter
, at least for simple cases. You can find it at: https://api.danielleu.com/public/tf5/v1/files/prompterHelper-v2.js
Place the code in a form named Scripts
and call it prompterHelper
. Here is a little example:
document.getFormNamed('Scripts').runScriptNamed('prompterHelper');
async function myFunction() {
try {
await textPrompter('Enter date');
console.log("Text entered: " + prompterVar);
} catch (errorText) {
// user clicked 'Cancel'
console.log('cancelled');
return;
}
// user clicked 'yes'
// continue with function
// main code here
console.log('continue from yes');
}
myFunction();
As you see, the entered text is stored in the variable prompterVar
. As Brendan showed, this would need to be parsed in order to get date object.
Hi Daniel,
Sorry I didn’t see this until today, but this is great I really appreciate it. I shall have a play around with this and try to incorporate into my db.
Thanks again! 😁