SDerrick
10th January 2014, 13:19
Hello,
We have a session where the user can enter an order number, a quantity, click a "process" button and it books production. After the process has run we want the reset the form fields and move the cursor back to the order number field, ready for them to enter a new number.
The only way I have found to move the cursor back to the order number field is by using to.field() and it works however, when the user types in the order number and presses tab, the actions in the when.field.changes and check.input sections are not executed which causes the rest of the process to fail.
Does anyone have a clue as to why this is happening. I have tried execute(modify.set) instead but this doesn't resposition the cursor to the order number field.
Any help would be appreciated.
Thanks in advance.
Simon
bhushanchanda
10th January 2014, 13:38
Hi,
Try :-
field.field_name:
after.input:
|....your code here.....
As per the Prog Guide:-
In this subsection, you can use the to.field() function if the sequence deviates from the default.
Also, in LN Tools , if you have a DAL for a tablefield, then the UI check.input section is skipped.
Also, keep in mind, to.field is not supported in Webtop.
SDerrick
13th January 2014, 09:48
Thanks for your reply Bhushan but after changing the when.field.changes section to an after.input section the behaviour is still the same.
bhushanchanda
13th January 2014, 09:52
Hi,
Are you using input.again() inside the section?
Please post your code snippet if possible. That will help understanding the issue better.
SDerrick
13th January 2014, 10:22
Hello,
No, we're not using input again. Here is the relevant parts of the script:
"THIS IS THE FIELD WE WANT TO INITIALISE AND RETURN TO AFTER THE FUNCTION "PRNT.LABEL" HAS RUN"
field.pdno:
before.input:
mitem = ""
mdsca = ""
mqrdr = 0
mqdlv = 0
pdno = ""
quan = 0
display.all()
execute(first.set)
after.input:
mitem = ""
mdsca = ""
select a.mitm:mitem, b.dsca:mdsca, b.item, a.qrdr:mqrdr, a.qdlv:mqdlv, a.osta:mosta
from tisfc001 a, tcibd001 b
where a._index1 = {:pdno}
and a.mitm refers to b
selectdo
endselect
display("tot.qty.prnt") |GWY_SDE1401091.n
quan = mqdlv - tot.qty.prnt |GWY_SDE1401091.n
display("mitem")
display("mdsca")
display("mqrdr")
display("mqdlv")
display("quan")
rebuild.query()
execute(first.set)
check.input:
select tisfc001.osta
from tisfc001
where tisfc001._index1 = {:pdno}
selectdo
if tisfc001.osta < tcosta.in.prod then
set.input.error("tigwy3505.03")
endif
endselect
AND THIS IS WHAT I HAVE FOR THE FUNCITON prnt.label:
choice.prnt.label:
after.choice:
pdno = ""
to.field("pdno")after using the to.field function the user can enter another production order number and press tab, but non of the field sections for "pdno" are executed at all.
Thanks for any suggestions in advance.
Simon
bhushanchanda
13th January 2014, 10:31
Hi,
Try moving your code from check.input: to after.input: section if it works.
|THIS IS THE FIELD WE WANT TO INITIALISE AND RETURN TO AFTER THE FUNCTION "PRNT.LABEL" HAS RUN"
field.pdno:
before.input:
mitem = ""
mdsca = ""
mqrdr = 0
mqdlv = 0
pdno = ""
quan = 0
display.all()
execute(first.set)
after.input:
mitem = ""
mdsca = ""
select a.mitm:mitem, b.dsca:mdsca, b.item, a.qrdr:mqrdr, a.qdlv:mqdlv, a.osta:mosta
from tisfc001 a, tcibd001 b
where a._index1 = {:pdno}
and a.mitm refers to b
selectdo
endselect
quan = mqdlv - tot.qty.prnt |GWY_SDE1401091.n
select tisfc001.osta
from tisfc001
where tisfc001._index1 = {:pdno}
selectdo
if tisfc001.osta < tcosta.in.prod then
mess("tigwy3505.03")
input.again()
endif
endselect
rebuild.query()
execute(first.set)
display("mitem")
display("mdsca")
display("mqrdr")
display("mqdlv")
display("quan")
display("tot.qty.prnt") |GWY_SDE1401091.n
|AND THIS IS WHAT I HAVE FOR THE FUNCITON prnt.label:
choice.prnt.label:
after.choice:
pdno = ""
to.field("pdno")
bhushanchanda
13th January 2014, 10:42
Hi,
There are other sections too which can be used:-
before.checks, after.input, on.input,check.input,when.field.changes.
The sequence goes like this:-
before.checks -> check.input - > on.input -> when.field.changes - > after.input
SDerrick
13th January 2014, 12:21
Hi,
Try moving your code from check.input: to after.input: section if it works.
Hello,
All of the current sections work fine when the user opens the session and inputs the first production order number, if they then execute the function prnt.label then I need the system to move the cursor back to the pdno field and re-execute all of the sections for the field "pdno". Unfortunately, it executes none of them. This leads me to believe that using the to.field is not the correct way to go but I have tried modify.set and add.set but this doesn't work either. I was hoping that somebody out there could give me the correct way to do this.
I wish I could think of another LN session which has similar behaviour, then I could take a look at the script and copy it.
Regards
Simon
bhushanchanda
13th January 2014, 12:35
Hi,
As per the Prog Guide:-
In a well-designed GUI, users (and not the application) select and initiate the actions to be performed. Using to.field() removes control from the user. Therefore it does not conform to good GUI design principles.
And yes, do check if you have solution #1464790 installed. It's related to to.field() function.
bhushanchanda
13th January 2014, 13:22
Hi,
I just checked it on one of my forms and it works fine. Try commenting these 2 lines from your before.input: section.
display.all()
execute(first.set)
SDerrick
13th January 2014, 18:01
Thanks for the pointer towards that solution. That will surely be worth a try. I'll see if commenting out the lines helps too.
Regards
Simon
shah_bs
13th January 2014, 23:26
pdno = ""
I am curious why you do not get any compilation error message for setting pdno to "", since pdno is a numeric domain field. Let us say that you have defined pdno in the program as character, then the select from tisfc001 should give an error.
Having said that, in order for a when.field.changes to trigger, the field should be 'seen' to have changed by the standard program. What you could try is to set it to a value of a non-existent production order number (say 99999999), so that when the user enters the next value, the field has really changed.
I do not remember now exactly if it was related to the to-field() function, but it is possible that the display statements are interferring somehow with the under-the-hood working. So, [similar to what bhushanchanda recommended] maybe try commenting those out first to see if it helps - although this is not a very strong solution, because it is possible for a display statement to be added back in a future modification.
bhushanchanda
14th January 2014, 06:11
pdno = ""
I am curious why you do not get any compilation error message for setting pdno to "", since pdno is a numeric domain field.
In LN, its a string.
SDerrick
14th January 2014, 17:44
Hello, Thanks for your help. Unfortunately the solution is for a later feature pack that what we are using. I have now passed this onto Infor. If they provide any feedback I think will be valuable then I'll post it for your information.
Regards
Simon