Control App Parameter Passing...

Hi,

Sorry if this is a bit simple, but I’ve spent several hours now trying to work this out and can’t, so thought I should ask.

I have created a control application which contains several fields, some user entered and some calculated based upon the user entered data. The next thing that I’d like to do would be to pass some of the fields as parameters to a grid application and then use these params to filter the data. Try as I might I cannot figure out how to define the various input and output params using ScriptCase.

If anybody could point me in the right direction explaining how I define the parameters to pass between my Control app and my Grid app I would be grateful.

Thanks,

Mike

Re: Control App Parameter Passing…

You can perform this in several ways…

-use sc_link() to load the grid and send the variables to grid. (help has examples)
-create session vars and access them from the grid app.

Regards,
Scott.

Re: Control App Parameter Passing…

Hi Scott,

Thanks for the reply. I’m further on now, but still confused;-)…

I had tried the sc_link() macro but it seems that this does not work for Control forms, so I have now turned my attention to the sc_redir macro and added the following code to the OnValidateSuccess event on the controll form.

// Redirect to grid app.
sc_redir(‘grid_tb_vpulley’, param1=“Hello World!” );

This works.

I have added the following code to the OnApplicationInit event in my grid app (grid_tb_vpulley) to try to retreive the parameter.

if(empty($_GET))
echo “No GET variables”;
else
print_r($_GET);

When run it seems that no parameters are being passed to the grid application.

Any ideas what I’m doing wrong?

Thanks,

Mike

Re: Control App Parameter Passing…

It is possible that SC is using POST and _GET will not return the vars. Try using

$param1 = $_POST[‘param1’];
$param1 = $_REQUEST[‘param1’]; // checks get; post; cookie

The help file says the variables are accessible using [param1] in the called app. This simply means that SC is create a global session var and using their [] macro to access this session var.
This would also means that they are not using the header to send the data, and is only available using their global [param1] macro. so _POST and _REQUEST will return nothing as well.

You could also just create your own session vars and access them from the app and not rely on SC if the macros are not working.
Understand that the macros are just shortcuts to creating PHP code. Sometimes it is easier to just do that yourself. SC macros tend to make you lazy. Do not forget that this is all just PHP and you can just create the code yourself.

http://www.scriptcase.net/forum_en_us/index.php?topic=5506.msg13467#msg13467

Regards,
Scott.

Re: Control App Parameter Passing…

Thanks Scott,

As per your suggestion I decided to declare my own session variables. I do this in the OnValidateSucces event of the control form and then use the sc_redir macro without parameters to call my grid application. This all seems to work perfectly.

Thanks again for your help and for pointing me in the right direction.

Regards,

Mike