mig28mx
21st July 2009, 20:03
Hello all,
I have a display type 2 session with several forms in it.
In some cases, for example, I have data on form 4, and no data on form 1.
When I pass to form 4 and then to form 1, the data of form 4 "remains", on the screen of form 1.

How to blank the form 1 before to display its data?

I have tried with, get.screen.defaults(), display(), and display.all() functions, on init.form section without success.

Any ideas?

Thank you in advance.

sushil
21st July 2009, 20:55
try execute(find.data)

mig28mx
21st July 2009, 21:03
Hello
Sushil, yes, I have also tried execute(find.data), but sometimes works perfect and others, the old records, remain in the form.

Any other idea?
Thanks.

manish_patel
22nd July 2009, 07:14
Make sure that key fields are present in all the form; if you are displaying data from same main table on all the form.
(Assumption: same record is getting display as various fields in different form.)


If that is not the case then you can try before.form subsection.


I have tried with, get.screen.defaults(), display(), and display.all() functions, on init.form section without success.


form.all:
before.form:
display()/display.all()/execute(find.data)

mig28mx
28th July 2009, 18:15
Hello Manish,
I have tested your solutions, but still have the same behavior.

Any other idea?

Thank you in advance.

mark_h
28th July 2009, 18:42
Do these forms use different tables? I curious how form 1 can be blank, form 4 have data. Then when clicking on form 1 it does not at least display the key fields for index on the session. Maybe some screen shots would give some of us an idea or two.

Thanks

mig28mx
28th July 2009, 19:02
Hello Mark,
I´m attaching some screens where you can see the bug.
Thank for your help.

Also here is my code


before.program:
import ("name",name)
import ("fami",fami)
name1 = toupper$(shiftl$(strip$(name)))
ncmp.log = get.compnr()

form.1:
before.form:
ncmp.log = 835
name2 = chr$(34) & ".*" & name1 & ".*" & chr$(34)
if not isspace(fami) then
query.extension = "tiitm001._compnr = 835 " & "and tiitm001.dsca like " & name2 &
" and tiitm001.citg = :fami"
else
query.extension = "tiitm001._compnr = 835 " & "and tiitm001.dsca like " & name2
endif
regs1.cia = "835 Minera Real de Angeles"
rebuild.query()
execute(first.set)

form.2:
before.form:
ncmp.log = 855
name2 = chr$(34) & ".*" & name1 & ".*" & chr$(34)
if not isspace(fami) then
query.extension = "tiitm001._compnr = 855 " & "and tiitm001.dsca like " & name2 &
" and tiitm001.citg = :fami"
else
query.extension = "tiitm001._compnr = 855 " & "and tiitm001.dsca like " & name2
endif
regs1.cia = "855 Minera San Felipe"
rebuild.query()
execute(first.set)

form.3:
before.form:
ncmp.log = 865
name2 = chr$(34) & ".*" & name1 & ".*" & chr$(34)
if not isspace(fami) then
query.extension = "tiitm001._compnr = 865 " & "and tiitm001.dsca like " & name2 &
" and tiitm001.citg = :fami"
else
query.extension = "tiitm001._compnr = 865 " & "and tiitm001.dsca like " & name2
endif
regs1.cia = "865 Minera Tayahua"
rebuild.query()
execute(first.set)

form.4:
before.form:
ncmp.log = 875
name2 = chr$(34) & ".*" & name1 & ".*" & chr$(34)
if not isspace(fami) then
query.extension = "tiitm001._compnr = 875 " & "and tiitm001.dsca like " & name2 &
" and tiitm001.citg = :fami"
else
query.extension = "tiitm001._compnr = 875 " & "and tiitm001.dsca like " & name2
endif
rebuild.query()
regs1.cia = "875 Minera Maria"
execute(first.set)

form.5:
before.form:
ncmp.log = 885
name2 = chr$(34) & ".*" & name1 & ".*" & chr$(34)
if not isspace(fami) then
query.extension = "tiitm001._compnr = 885 " & "and tiitm001.dsca like " & name2 &
" and tiitm001.citg = :fami"
else
query.extension = "tiitm001._compnr = 885 " & "and tiitm001.dsca like " & name2
endif
regs1.cia = "885 Minera San Francisco"
rebuild.query()
execute(first.set)

mark_h
28th July 2009, 19:50
Okay - I think I understand. Form 4 has records, then when you click on form 3 it does not have any records to do display, so it should be empty? Correct? For this I can see a couple of possibilities - I am not sure what will work if execute(find.data) does not work: (1) You might try a display.all() or refresh() right after the execute(find.data) or (2) if those do not work you could always test before rebuilding the query. What you could do is run a query, test if there are records, give the user message saying no records and prevent the user from changing to that form. I am willing to bet that display.all() and refresh() do not work simply because there are no records to display. Just thought of (3) In the after.form of the form.all session you call always roll through the first x number occurences setting the variables to empty(or something like that) using the do.occ() functionality.

If there are records to be displayed and you are rebuilding the query. Then the execute(find.data) should solve the problem. At least from the other post I have read(searching on rebuild.query). So hopefully if there are records for each of the queries on each form then switching forms should work.

shah_bs
28th July 2009, 20:33
Or you could explore the store.occ.min() and store.occ.max() functions to be used along with execute(find.data).

But first, I think, if you tried execute(find.data) followed by execute(first.set), that should work.