pjohns
27th March 2002, 09:43
Can anybody help me please?
I'm trying to set the default value of an enumerate field on the tdsls4102s0001 form. The field is tdsls041.scom. I have set the default value as shown in the attached document, compiled my form but when I go into Maintain Sales Orders -> Lines and add a new line the default for Ship Complete is shown as "No".
I have also tried entering "1" and fmin($#) to set the default.
Is there anything else that I need to do?
Thanks
PJ
NPRao
27th March 2002, 10:10
Hi,
I dont think you would use the fmin($#) or fmax($#) on an enumberated field. try to use the default value directly as tcyesno.yes or just try "yes" in the default option on the form editor.
else you can also use the function in your script,
yntax
void set.fields.default()
Description
It is possible to define default values for form fields with the form editor. For all fields of the current form, this function sets the corresponding script variables to the default form values.
The function is often used before batch or print programs, where the user must specify some parameters for the batch run.
Context
4GL library function.
You can use this function only in form sections of 4GL scripts.
See also
get.screen.defaults()
Example
form.1:
init.form:
set.fields.default()
OmeLuuk
27th March 2002, 10:31
There are different ways to set a default:
1) on the form
2) via session defaults per user
3) via the table definition
4) in the session
There may even be more.
The session object overrules over all.
In the session script it sais:
> field.tdsls041.pono:
> before.input:
> if tdsls041.pono = 0 and choice <> def.find then
> ...
> tdsls041.scom = tdsls040.scom
In this case the default is taken from tdsls040.scom, so set your default there.:D
mohdsuhardi
8th June 2012, 10:09
Can the default field in a form get a value from another form. for instant, when form A is opened, and when user click to open Form B, can we set a default value in field in Form B to refer a value in Form A without doing anything from the script? thanks
bdittmar
8th June 2012, 16:30
Can the default field in a form get a value from another form. for instant, when form A is opened, and when user click to open Form B, can we set a default value in field in Form B to refer a value in Form A without doing anything from the script? thanks
Hello,
without modifying the script, i guess NO !
Regards
tomlbacon
8th June 2012, 18:07
If you have pressed the buttom to saved the defaults for this screen you need to remove them to get the defaults on the sceen to show up.
Hitesh Shah
8th June 2012, 19:47
If there is script which is modifiable , there are many ways .
If there is no script , a crude workaround is to have a auto zoom customized session on the form field which executes some code to get value from first form and export it to parent in the before.program section and ends the program in the before.program itself (so no screen of zoom session comes ) . This way u will have you default from other program.
Check this board for sample codes on get.var , put.var , pstat functions which can assist u in writing such codes.
mohdsuhardi
13th June 2012, 06:36
Hi all,
Thanks for the reply, i guess there will be no other way instead by modifying the script..
thanks