I need to fill in a default value for a submit point metadata field. Is it possible to use a script expression to create a value, using previously entered selections in the submit point form?
For instance, I have field where the user selects a type of product. Another value necessary to pass in the XML for the flow is the ID code for that product. I don't want to leave the user to select it, since a wrong selection could lead to problems later in the flow. Is it possible to use a script expression to generate that value using the previously selected product type?
Submit point script expression question
Re: Submit point script expression question
I did a little with submit points, but I'm not sure if you can push data back into the submit point GUI.
You can capture the data set associated with a submit point like this:
This script was triggered by an XML file being entered into the flow by the submit point. I used values selected in the submit point to edit that XML file later on.
As far as setting a default value in the submit point I'm afraid I can't help you, but this page makes it sound like you need to find the backing file and update that: https://www.enfocus.com/manuals/Develop ... class.html
You can capture the data set associated with a submit point like this:
Code: Select all
var submitData = job.getDataset("Submit");
//"Submit" I believe is the name of your submit point that you define.
if (submitData.hasValidData()){
//you can pull data out of the submit point fields using XPaths to the field-list/field you want.
//there's probably a better way to reference a field that by using the index, but I was in a rush and couldn't figure it out.
var textPress = submitData.evalToString("/field-list/field[1]/value", null);
//do something with that value
}
As far as setting a default value in the submit point I'm afraid I can't help you, but this page makes it sound like you need to find the backing file and update that: https://www.enfocus.com/manuals/Develop ... class.html
Re: Submit point script expression question
The script expressions for submit points default values are all executed on the Switch Server between the moment you drop a file on the submit point and the moment you see the form to fill in the metadata in the webclient. (This is the reason it can take a while for the form to show up if you have long lasting script expressions).
Since these script expressions are executed before the form is actually shown they can't access information that a user will fill in into the form once it is available.
Several people including me have requested Enfocus to make this possible. Feel free to also ask Enfocus, the more people request it, the bigger the chance it will get implemented someday
The only solution at the moment is quite involved: Create a webpage yourself with a form where a user can select the type of product and in a second form field the ID of a product with a dropdown filled in based on the value of the type of product field. Then create an XML from the values filled in into the form and push this to Switch. The big downside here is that you have to write your own webpage, which takes quite some time and the necessary skills.
Since these script expressions are executed before the form is actually shown they can't access information that a user will fill in into the form once it is available.
Several people including me have requested Enfocus to make this possible. Feel free to also ask Enfocus, the more people request it, the bigger the chance it will get implemented someday
The only solution at the moment is quite involved: Create a webpage yourself with a form where a user can select the type of product and in a second form field the ID of a product with a dropdown filled in based on the value of the type of product field. Then create an XML from the values filled in into the form and push this to Switch. The big downside here is that you have to write your own webpage, which takes quite some time and the necessary skills.
Re: Submit point script expression question
After some more thought, I decided to go another way. I downloaded the "private-data-write" script from open-automation's GITHUB page. I will just assign all the xml form entries to private data. The downloaded script also allows a script expression to be entered to resolve the data for the key, so I can resolve the data I need by using a script expression I wrote.
Thanks for everyone's input and I will post the request to Toon when I get a chance. So, what is the actual *use* of being able to enter a script expression in the form, if entered data cannot be used? Seems pointless to me.
Thanks for everyone's input and I will post the request to Toon when I get a chance. So, what is the actual *use* of being able to enter a script expression in the form, if entered data cannot be used? Seems pointless to me.
Re: Submit point script expression question
You can do interesting things with script expressions in submit points. It allows you to get information from outside of Switch:
- Request things via a HTTP API
For example, list all the presets of a RIP and show them to the user. Then that preset can be used when sending the job to that RIP.
- Read values from a CSV file which is managed outside of the Switch server and make a dropdown out of that in the webclient
- Request values from a database and do some postprocessing on them
- ...
- Request things via a HTTP API
For example, list all the presets of a RIP and show them to the user. Then that preset can be used when sending the job to that RIP.
- Read values from a CSV file which is managed outside of the Switch server and make a dropdown out of that in the webclient
- Request values from a database and do some postprocessing on them
- ...