[SOLVED] Form in tab applications

Hello, this is my first post here!

I have a simple question:
is there a way to use sc_select_where(add) macro in forms?
I don’t understand why this is limited only to grid applications.

I have the following problem:
an application for customers records which should work alone OR inside of a TABS application.
Inside the tabs application I need to set a SQL where statement with a global variable and it works correctly
but when I open the form application all alone it gives an error because the global variable is not set.

Maybe this is a low-profile question but I’m having a really hard time in finding even simple answers to my scriptcase issues
and any help would be appreciated!

Thanks and have a good day!
Virgus

Re: Form in tab applications

Hi,
question is if you want to run the form with the where clause in stand alone mode as well.
If so, you can either define a session variable or check for the global variable before the SQL command is initiated. The good spot would the onScriptInit event.

i.e.
if(!isset([glb_variable]))
{
[glb_variable]=some_value;
}

Hope that helps.

jsb

Re: Form in tab applications

Thanks jsb for your reply,
many thanks indeed.

If I keep the where clause in stand alone mode and use your trick
then how can I either have all the results like if I had no where clause at all?
As you said I can override the error of not having a value by providing a correct value,
but I would like to override the where clause.

Kind regards,
V.

Re: Form in tab applications

Hi,
let’s try another approach.

Go to the SQL section of your form.
Put a global variable in the WHERE field, nothing else. Let’s say [where_clause].

Now go to the onScriptInit event and fill in the following code.

if(!isset([glb_variable]))
{
[where_clause]="";
}
else
{
[where_clause]=“field_name=”.[glb_variable];
}
if(!isset([glb_variable]))
{
[glb_variable]=some_value;
}

That could probably do it.

jsb

PS: The [where_clause] variable has to be marked as OUT in Application --> Global Variable!

Re: Form in tab applications

THANK YOU!!! So much!

Very simple and smart: a genial solution! It worked great!

Have a good day!!!
Virgus