Search found 645 matches

by gabrielp
Tue Apr 30, 2019 8:01 pm
Forum: LEGACY scripting
Topic: Multiple File/Folder Inject
Replies: 1
Views: 4609

Re: Multiple File/Folder Inject

I think there's a lot of ways to skin this cat -- looking forward to other's responses. Based on your description I guess I would write a little script to create jobs with the name of each job number in my array. So if my dataset value was "123, 124, 125, 126" I would send the triggering f...
by gabrielp
Tue Mar 26, 2019 8:50 pm
Forum: Switch
Topic: URLencode Body text
Replies: 8
Views: 10970

Re: URLencode Body text

I haven't used Switch in a while -- so take this comment with a grain of salt. The easiest (laziest?) way I can think of would be to remove any characters that need to be encoded. You could do that with a little regex or use a script like this (which will do that for you) https://github.com/open-aut...
by gabrielp
Thu Mar 14, 2019 1:01 am
Forum: LEGACY scripting
Topic: JavaScript working with an array
Replies: 6
Views: 10141

Re: JavaScript working with an array

Is it possible to echo variables from a script out to somewhere to see what a script is producing? You could log a variable and read it there: var myCoolVariable = [1,2,3,4,5] job.log(1, "MyCoolVariable: " + myCoolVariable.toString() ); var myCoolIndex = 3 job.log(1, "Selected value ...
by gabrielp
Thu Mar 14, 2019 12:40 am
Forum: LEGACY scripting
Topic: How to create a dataset
Replies: 8
Views: 19209

Re: How to create a dataset

Ok... This may be a dumb question, but is there a way to attach a complete dataset to one private data key...? No dumb questions here. I haven't used Switch in a little while but here's my take on this. The private data methods (setPrivateData, getPrivateData) allow you to set and get strings (http...
by gabrielp
Wed Mar 13, 2019 6:23 pm
Forum: LEGACY scripting
Topic: How to create a dataset
Replies: 8
Views: 19209

Re: How to create a dataset

For simple key value pairs its much easier to write to private data -- but here is an example of writing to a dataset:
- https://github.com/open-automation/swit ... #L324-L367
by gabrielp
Fri Mar 08, 2019 3:46 pm
Forum: LEGACY scripting
Topic: GetPrivateData Iteration
Replies: 2
Views: 4705

Re: GetPrivateData Iteration

Thanks for following up with the solution! If it helps anyone else, here is a snippet of code I used previously to iterate over private data tags using JS: https://github.com/open-automation/swit ... js#L53-L65
by gabrielp
Thu Feb 28, 2019 4:52 pm
Forum: LEGACY scripting
Topic: JSON with special characters
Replies: 8
Views: 16345

Re: JSON with special characters

Curious -- does your web server/API get the request? Is it returning an empty response? Or is the request not even getting there? Yes, it is returning a empty response. No error. If I use a JSON without special characters everything is working fine. Can you confirm that with the logs from the API s...
by gabrielp
Wed Feb 27, 2019 3:48 pm
Forum: LEGACY scripting
Topic: JSON with special characters
Replies: 8
Views: 16345

Re: JSON with special characters

Curious -- does your web server/API get the request? Is it returning an empty response? Or is the request not even getting there?
by gabrielp
Wed Feb 20, 2019 5:35 pm
Forum: LEGACY scripting
Topic: Combining pdf's
Replies: 3
Views: 5992

Re: Combining pdf's

Well, apart from building the PDFs twice from the beginning (one for print, the other for whatever other case you need in 15 sets), there is something I have done before. We added a key to each PDF (in this case, the name of your set/group). We actually made this text invisible but it was on each pa...
by gabrielp
Wed Feb 06, 2019 3:25 pm
Forum: Flows
Topic: Set Private Data to SQL result
Replies: 2
Views: 24255

Re: Set Private Data to SQL result

You likely have the Switch database module/configurators which I'm not familiar with but I figured I'd share this script which uses ODBC and has several ways to save results as private data. You can save a single result or a series result as private data. You also can save the result as a dataset ht...
by gabrielp
Tue Jan 08, 2019 3:24 pm
Forum: LEGACY scripting
Topic: Convert a script to use Traffic Light output
Replies: 6
Views: 8565

Re: Convert a script to use Traffic Light output

NEW - My guess was to do this if (resu !== "Success") { //throw new Error("Invalid response from web service: " + resu); job.sendToData( 3, job.getPath() ); } return resu; } Looks good to me, if what you want to do is, on SOAP error, move the input job into the error connector. ...
by gabrielp
Mon Jan 07, 2019 10:39 pm
Forum: LEGACY scripting
Topic: Convert a script to use Traffic Light output
Replies: 6
Views: 8565

Re: Convert a script to use Traffic Light output

This script/app is an example of using traffic light connectors: https://github.com/open-automation/swit ... #L274-L280
by gabrielp
Wed Jan 02, 2019 3:05 pm
Forum: LEGACY scripting
Topic: File count to report writing
Replies: 4
Views: 6698

Re: File count to report writing

This script/app counts on line breaks using the method Jan mentioned above:
- https://github.com/open-automation/switch-count-rows
- https://www.enfocus.com/en/appstore/product/count-rows
by gabrielp
Mon Oct 29, 2018 2:40 pm
Forum: Flows
Topic: Remove file after 1 day
Replies: 3
Views: 4410

Re: Remove file after 1 day

Assuming the folder is not automanaged in the flow: you can remove stuff by putting a file (perhaps a copy of that file) behind a hold for 1 day, then routing it into an inject which pulls it out of the folder and deletes it. Not exactly sure what you meant about effecting other files. But you're go...