pralash
27th March 2018, 11:51
Hi,

I've created my own DAL Script... And I have used the on.input for a particular field in order to making the validation process. But I got the error while compile my DAL Script... Hence can I use the on.input function in DAL script... Is it possible or not?

Thanks in advance,

Regards,
Pralash

Ajesh
27th March 2018, 12:15
What exactly you want to do with that field? Do you want to Validate the field in DAL? If yes then you need to write it in fieldname.check()


fieldname.check()
Syntax:
function long field.check (long has_changed [, long element])

Description

Use this hook to program logical integrity rules for a specified field. The function name is ppmmmvss.bbbb.check(), where pp is the package code, mmm is the module code, vss is the table number, and bbbb is the field name.

Insert a new object Update an existing object
Does the property check for all fields.

The has_changed flag is always set to DAL_NEW. Also for fields that are not changed!
Does the property check for all fields.

The has_changed flag is only set to DAL_UPDATE for changed fields. For unchanged fields, the flag is cleared.



Arguments
long has_changed
[long element] This is set for array fields only. It indicates the index of the array element that must be checked.


Return values
This hook returns 0 if the value of the field is accepted. It returns a negative value (DALHOOKERROR) if the value is not accepted.

Context
This function is implemented in the 4GL Engine and can be used in DAL script types.

pralash
27th March 2018, 14:17
Thanks so much for your response...

Actually , I make a filed as mandatory.. So I have enabled the "mandatory field" option in the table design.. When I bypass the filed without giving any input value at that time, the error message "Enter a value for the Item field" is displayed for first... Suppose if I perform the same process for second time, it does not show the error message as "Enter a value for the Item field"... Hence in order to make the field as "Mandatory", I'm using the following script as follows...

field.tcemp103.mar2:
on.input:
if isspace(tcemp103.mar2) then
dal.set.info.message("@%1s","Enter a value for the Item field")
show.dal.messages(MSG.INFO)
input.again()
endif

But i'm getting the error below error while come the DAL script..
ptcemp1030( 28): Error: 'on.input' not expected. Hence can I use the "on.input" section in DAL Script or not?

Thanks,
Pralash

JaapJD
27th March 2018, 15:29
Messages are given only once during entering values in the screen (or keeping fields empty). But, the message will be given again during save.
on.input() cannot be used in DAL.

pralash
27th March 2018, 15:40
I understand about regarding "on.input" in DAL...
Thanks so much for your information....

Regards,
Pralash