Variable problem in Tab application

I have two tabs, one for Customers [registration form] and the other for Orders [Contain a customer ID field]
i use the Tab application.

In the Orders SQL i put this code: customer_id = [var_customer]
In the global variables session selected and the type is : IN

In the Customer [on load event] i put this code: [var_customer] = {customer_id};
In the global variables session selected and the type is : OUT

  • Note: in both applications the Customer ID field is: customer_id

I successfully run the application and when i select a Customer i got it’s orders but the problem when i want to add a new order the customer ID change so i have to select my customer again manually and what i want is to use the session not only for filtering [witch is working perfectly] but also to add a new orders related to a customer that i already select before.

You can look into the faq’s of SC how to move data between the two iframes which should do the trick. I’m not a javascript guru so I useually do it the following way (less sophisticsated but works for me).

In the onafterinsert I do a redir to the tab application and set the global variable., Something like

sc_redir(myapp.php,var_customer={customer}, _parent);

Thank you so much [aducom] appreciate your help. i will give it a try.

http://www.scriptcase.net/forum/showthread.php?5874-define-a-variable-in-session&p=22011#post22011

Yes I have put it in a faq. Tnx for your explanation.

Assume that you have two applications.
first make sure that app2 (orders for example) have app1 ID field (customer for example),
now go to app1 Events => onload event:
[variable] = {field};
from applications go to global variable and tick (session) and the type: out
now go to app2 Events => onload event:
{field} = [variable];
go to Where Condition in SQL and put this:
field = [variable]
from applications go to global variable and tick (session) and the type: in

you are done! now you can pass the variables between tabs that contain your applications without any problem.

Thanks Albert. Description above works without problem if App2 (form) Orientation is: Single Record.
in case you change it to editable grid or editable grid view then it will never work! i do not know why.

where r the whole faqs that u are adding such info, Albert!?

On the site which is below this post.

oh, thats is good Albert, but don’t you think that like this will have separated placed for information sources? i mean if you can guys hold them all in one place then will be stronger and everybody will ahve more info, right!?

however, i really appreciate your help Albert, really, for many days reading in the forums and I wonder how you can manage time to help everybody :slight_smile: good work, i wish there are many people like you have experience and info AND they help others, everybody will be happy then :slight_smile:

i have a couple of questions though, will post them in new threads not to mix ok :slight_smile:

thanks