help_ln
5th March 2007, 15:09
Hi,

I am developing a session that has 4 fields on the form.

After the input of three fields, i need to check the relation between the three fields which i do in the check.input of the third field.
Now if error comes, i want to initialize the form and input all the three fields again.

How to proceed.
Pls suggest.
Its urgent.

Thanks

mark_h
5th March 2007, 15:26
If the error is found just reset the fields and use to.field to go back to field number 1. You might also try execute(init.form) - not sure if this will work.

help_ln
5th March 2007, 15:52
I did this ...
but the cursor goes to the third field as i am writing this in the check.input section of the third field.
Though in to.field i have specified the field name of the first field.

Pls suggest.

Thanks

mark_h
5th March 2007, 16:09
You can only use the function TO.FIELD in the subsections after.input, after.display and after.field. Of course I am on 4c4 so I do not know what other options are available for 6. Of course I just checked execute also and it does not mention check.input. Depending on how the form is setup you can always just use the before.input on field 4 and skip input, sending it back to field 1(of course this depends on how the form is setup).

en@frrom
5th March 2007, 16:19
Also try input.again() (in combination with to.field())

NPRao
5th March 2007, 23:22
help_ln,
After the input of three fields, i need to check the relation between the three fields which i do in the check.input of the third field.
In LN, if these are table fields then you have to write the methods in the DAL and not in the UI script.
Now if error comes, i want to initialize the form and input all the three fields again.
I did this ...
but the cursor goes to the third field as i am writing this in the check.input section of the third field.
Though in to.field i have specified the field name of the first field.
A form is initialized only once. As a work around, you can use the groups concept in DFE -

4GL group sections
--------------------------------------------------------------------------------
With dynamic forms, the mapping of groups to forms is not fixed. Consequently, the only form sections that are relevant to dynamic forms are the form.all and form.1 sections. When dealing with dynamic forms, you use group sections instead of form sections

You use group sections to program actions that you want to be executed when a particular group is activated or ended. Group sections consist of a main section and a subsection. The main section specifies the particular group(s) for which the actions are to be executed. The subsections specify when the actions must be executed – for example, when the group is activated or when the group is ended.

Note that a group becomes active when the form on which it occurs becomes current.

You can use the command to.group() and re-initialize the fields using commands - get.screen.defaults() or set.fields.default()
But then, using the new LN Tools methodology you can completely write this in DAL2-

SSA ERP LN 6.1 Programmers Guide
DAL2 and the 4GL Engine
--------------------------------------------------------------------------------
The following table gives an overview of what hooks the 4GL engine calls to update the User Interface. For a number of UI event sections you can see which hooks are called. Note that the actions performed by the 4GL engine are executed just before the mentioned UI section is called. In this way it is possible to e.g. disable a field based on other than DAL constraints.

UI section
DAL2 Hooks called

after.form.read:
remove unused fields
remove unused form commands

field.is.never.applicable()
business.method.is.never.allowed()

before.new.object:
set default object values

set.object.defaults()

before.display.object:
enable/disable maintable fields

determine enum values
enable/disable standard commands
enable/disable form commands

field.is.applicable()
field.is.readonly()
field.is.derived()
field.enum.constant.is.applicable()
method.is.allowed()
business.method.is.allowed()

choice.mark.occur:after.choice:
enable/disable standard commands
enable/disable form commands

method.is.allowed()
business.method.is.allowed()

field.<fieldname>:check.input:

field.is.never.applicable()
field.is.applicable()
field.is.readonly()
field.is.derived()
field.is.mandatory()
field.is.valid() / field.enum.constant.is.applicable()

field.<fieldname>:when.field.changes:
trigger dependent fields

enable/disable maintable fields

determine enum values
enable/disable standard commands
enable/disable form commands

field.is.applicable()
field.is.readonly()
field.update()
field.is.applicable()
field.is.readonly()
field.is.derived()
field.enum.constant.is.applicable()
method.is.allowed()
business.method.is.allowed()

main.table.io:read.view:
enable/disable standard commands
enable/disable form commands

method.is.allowed()
business.method.is.allowed()

If you used set.input.error() in your check.input of the 3rd field, then the cursor stays there.

In short, your requirement is not clear based on your posting, you have to post your custom code and marking it 'urgent' does not aid much for you.