mig28mx
29th August 2008, 17:16
Hello All,
I´m having the following problem.
I have a subsession that calls another session.
But I need that, the subession 2, selects only the records selected in subsesion 1. I have tryed the board´s suggestions using functions IMPORT and export, but no success.

I have all the sessions with option 6 (search) but also tryed witn options, 7 and 44.

Any suggestions?
Thanks in advance.

Here is my code

Main session:

choice.user.0: |Historial
on.choice:
if(not marked) then
message("No ha seleccionado ningún registro")
choice.again()
else
spool.device = ""
export("year",year)
export("peri",peri)
zoom.to$("tfcmg8587s000",Z.SESSION, "", "",0)
endif

Subsession 1

before.program:
import("year",year)
import("peri",prod)

choice.user.2: | Importe Devuelto
on.choice:
spool.device = ""
export("year",year)
export("prod",prod)
zoom.to$("tfcmg8184m000",Z.SESSION, "", "",0)

choice.user.3: |Importe Acreditado
on.choice:
export("year",year)
export("prod",prod)
zoom.to$("tfcmg8185m000",Z.SESSION, "", "",0)

choice.user.4: |Importe Compensado
on.choice:
export("year",year)
export("prod",prod)
zoom.to$("tfcmg8186m000",Z.SESSION, "", "",0)

Subsession 2:

before.program:
import("year",year)
import("peri",prod)

Hitesh Shah
29th August 2008, 17:50
I dont c anywhere u assign main table key fields the right values . U can do so in either session . Standard program normally takes care of the rest.

mig28mx
29th August 2008, 18:08
Hi Hitesh,
Main session is a maintenance sesion. This is, when the user captures the values of year and period (peri) on the screen, these values are stored on the table.

This is you mean with, assign main table key fields??
Thank you in advance.

mark_h
29th August 2008, 18:13
In subsession 2 you are importing peri and year, but in subsession 1 you are exporting prod and year. So in subsession 2 try importing prod and year.

mig28mx
29th August 2008, 18:35
Hello Mark,
Here is the modification, but still not working...

Main session:

spool.device = ""
export("tfcmg887.year",year)
export("tfcmg887.peri",prod)
zoom.to$("tfcmg8587s000",Z.SESSION, "", "",0)

Subsession:

before.program:
import("year",tfcmg888.year)
import("prod",tfcmg888.prod)

mark_h
29th August 2008, 19:31
Try this:

Main session:
year = tfcmg887.year
prod = tfcmt887.peri
export("year",year)
export("prod",prod)

subsession:
import("year",year)
import("prod",prod)
tfcmg888.prod = prod
tfcmg888.year = year

mig28mx
29th August 2008, 21:34
Hello Mark,
I have done your suggestion, but still not working.
I have debugged the code, and I can see prod, and year have the rigth values, but when the subsession is called, allways give me the first record when I use option 44, and when I use option 6, Year and prod have 0 values.

Any other idea?
Thanks.

mig28mx
29th August 2008, 22:21
Hello all,
Finally I choosed to use query.extendsion as follows:

query.extension = "tfcmg884._index1 = {:year,:prod}"

Thank you all for your inputs.

Hitesh Shah
30th August 2008, 15:50
Hi Hitesh,
Main session is a maintenance sesion. This is, when the user captures the values of year and period (peri) on the screen, these values are stored on the table.

This is you mean with, assign main table key fields??
Thank you in advance.

Every maintain has a main table . What is the main table in subsession 2 . U should equate mani table key (ie index ) fields in subsession1 or subsession 2 before.rpogram / init.form from variables year / prod.

Further export / import only works with reference to parent session only ie when u export in subsession 1 , the values are changed in its parent ie main session . If u intend to pass it to subsession 2 , it's not required . Import in subsession 2 does the necessary work .

sprasad
1st September 2008, 08:59
Dear All,

I too faced this problem once.The reason i found was you have to use either export in the main session or import in the subsession which will solve the problem.As in this case mig had removed import in he sub section the problem get solved.I just wanted to know why it wont work when both export and import are used??

Regards,
Sai Prasad

Hitesh Shah
3rd September 2008, 09:37
Dear All,

I too faced this problem once.The reason i found was you have to use either export in the main session or import in the subsession which will solve the problem.As in this case mig had removed import in he sub section the problem get solved.I just wanted to know why it wont work when both export and import are used??

Regards,
Sai Prasad

If u read the import / export help carefully , it works only with 'parent' process only in child process . In parent process , import / export statements will not work with values in child process .

U can use get.var / put.var in circumstances where import / export is not relevant .