Dear all,
I got a php code connected to a button (send e-mail) and within the code I would like to use a sc_redir to run a pdf repord application passing to it a parameter.
I wonder if it’s possible , once run the pdf report, come back to next line of code to carry on with it. The pdf report makes a pdf file that I wont later to
attach to a mail .
Thanks
Nope - it’s a one-time deal. sc_redir() is not actually a “call” (more like an old style GOTO). It transfers control completely to the app you have directed it to (any lines after an sc_redir will NEVER get executed - unless wrapped in conditional code like below).
The workaround is to bounce around different apps using sc_redir, but maintain status information using global variables that the calling app can check to determine which bits of code in whatever events should run.
Something like:
In the calling app set up an “out” global var named [status] in onApplicationInit, and set it as “initial”.
Then set up a status check in onLoad:
if ([status] == "initial") {
//
// Do some initial processing here, and then redirect to other app
//
sc_redir(other_app);
} else if ([status] == "after_redir") {
//
// do your after a redir processing here...
//
} else if (...
Then in the app you re-direct to (other_app), when it’s done whatever it needed to do, add:
[status] = "after_redir";
sc_redir(original_calling_app);
^
|
|
This
Hello Adz and Giu,
thanks for hint. It’s a bit complicated to manage but if it’s the only way I will try.
I wonder also if it possible to run an application on background mode but I suppose it’s not so easy too.
For istance I got the pdf report set on server that save the pdf file produced on a certain directory.
I got always the message when it finish that say … Pdf generation terminated … if you like to come back to previous application…
I’ve still not found the way to hide it … ;-(((
[QUOTE=giovannino;38220]Hello Adz and Giu,
thanks for hint. It’s a bit complicated to manage but if it’s the only way I will try.
I wonder also if it possible to run an application on background mode but I suppose it’s not so easy too.
For istance I got the pdf report set on server that save the pdf file produced on a certain directory.
I got always the message when it finish that say … Pdf generation terminated … if you like to come back to previous application…
I’ve still not found the way to hide it … ;-((([/QUOTE]
In php there’s no background mode. You can run php in a cron for instance, but then you have no interactivity with the end-user: you cannot use screens. One option might be to create the pdf fully in your (control) application if that’s applicable. It requires a lot of manual code, but you are in full control.
Ok … I don’t know a lot of things…
No hints about hiding the default end of pdf generation message ?
I mean something like sc_exit(sel) that hide the Ok buttton.
I suppose that if you have set “PDF Destination” you haven’t any control
I solved using iReport & JasperStarter. You can create a “one-statementent-function” that create the report inside your control/app.
Hi Giorgio !!
Yes, probably it’s the best solution but I got only this Order Form and I don’t want to loose time on studying … another sw solution. My brain … is overcharged… and I got only some free bits to use … Lastly I need to put on agenda… at midday … remember to eat something … Thanks … Bye
Didn’t readed all the post, but, did you thought about do a “GET” to the PDF application with cURL, instead of redir?
Thanks Giu but for me it’s a too advanced level to use this library.
Googling I founded this
popen("./myscript.php", “w”);
Does it make sense ?
is the problem Always the return to php code ?
what you realy want is to call a subroutine (function) which will return to the next sentence. But as soon as you do a redir you are giving control to another phpfile. In some cases you can do a call to a php program and the load the result of that program and continue to the next line. That’s used in calling webservices or rest services and where curl comes in although there are other solutions. But scriptcase modules are not designed that way, they are just regular applications. I don’t see the point of the popen. It will open a php file in write modus (…)