pjohns
17th January 2005, 13:31
Hello,

If I need to make a certain field on the sales order line mandatory based on the value of another field can I do this from a setting on the form field or will it have to be done in the session script?

I'm guessing it has to be done from the session script, of which we do not have the source for. But I thought I would check.

Thanks

PJ

lakoon
17th January 2005, 14:52
Hello pjohns

You do have the possibility to set a flag in maintain forms for the required field.

/lakoon

pjohns
17th January 2005, 15:01
Thanks lakoon,

How would I achieve this using the form field? The field I want to apply the condition on is tdsls041.cprj

What I want to say is -

if tdsls041.cuno = "abc customer " then tdsls041.cprj is mandatory otherwise tdsls041.cprj can be blank

Thanks

PJ

malutz
17th January 2005, 16:32
As far as I know there is no way to add a condition in the form.

lakoon
17th January 2005, 18:24
Hello pjohns

Acutally the documentation says that it should be possible to enter a condition into the field "Input/Ref. Expression".
You have to use variables of type EXTERN.

But you can only set wether the field can be accessed or not. Like attr.input in the script.

/Lakoon

Hitesh Shah
20th January 2005, 17:22
The variable attr.mandatory makes the field mandatory. You can have an autozoom on tdsls041.cprj which syncronizes and calls existing zoom session/menu and it's return values in it's before.program sections itself. Besides that it should set the attr.mandatory to true and export the same to parent if tdsls041.cuno = ABC (value imported from parent).

lbencic
20th January 2005, 19:58
Also, just FYI, script wrapper tools like QKEY, RMCgen and 'rush' (freeware on these boards), can help you add validations such as these, and other logic, to the standard Baan session code without having the source.

Hitesh Shah
21st January 2005, 07:16
True , Alternatives galore.

In 1 more simpler way , you can just write following in input/ref in the form field tdsls041.cprj .

attr.mandatory := tdsls041.cuno = " ABC" ,1


AFS also maybe a choice if u wish so for this task.

lbencic
21st January 2005, 21:58
Hitesh - I just have to say - that is so cool :) The things we learn on these boards. You can use that trick then to also set the attr.input conditionally without the source, any of the attr.* form fields I guess.
To further how useful that attr.mandatory is, if the field is a table field, the mandatory / not mandatory is controlled at the table level, and the form option for 'mandatory' is greyed out. I just ran a test, and just by using:

attr.mandatory := true, 1

Then you can make the table field mandatory on the form, no table or code changes needed. Very nice. I think they could write a WIKI on all the possibilities with that Input / Ref field.

Hitesh Shah
22nd January 2005, 13:18
Yes Baanboard is just great . It's treasure of Baan tricks and techniques.

Input field / ref and default fields use the expr.compile function and both these fields are some 50+ characters long . U can always have some variables/tablefields set/reset in these field and use any of the possibilities of expr.compile .

jatin_sanghi
2nd July 2009, 09:14
HI,

Can we apply mutiple conditions here in Input/ Out Expr field on the form field.
I tried using IN..and it send an error.

Regards,

Jatin

ahmer91
2nd July 2009, 14:32
goto session ttaad4135m000 and apply the condition

manish_patel
2nd July 2009, 15:08
There is no other way; you have to modify program script.

mark_h
2nd July 2009, 15:30
HI,

Can we apply mutiple conditions here in Input/ Out Expr field on the form field.
I tried using IN..and it send an error.

Regards,

Jatin

Post the code that you were trying in the input field. It could just be a syntax error. I am sure Hitesh or another expert maybe able to help. I have never really tried this technique.

Hitesh Shah
2nd July 2009, 18:02
If u want to make a field mandatory in certain conditions , attr.mandatory is a way but user can still use mouse/arrow to move away .. And there is no check like check input at update.db .

Input / ref will simply determine whether input has to be allowed or not and what is the expression to do so. This expression has to be expr.compile syntax compliant . If u get error in this show the value u put therein.

Multiple conditions deinitely work but that has to be finished within 60 characters . If u use IN operator in ttaad4135m000 , it's 30 characrers.

Further if u wish to restrict the input to a certain restricted conditional list , U can auto zoom to a custom session and restrict the user choice in that session and the time of exit export the false value to attr.input of the calling session . That will restrict the user entry to valid list .

jatin_sanghi
3rd July 2009, 13:55
Hi,

I want to have tdsls401.cprj as mandatory if the order series is SX, SP, SA and non-mandatory for others. For that, I can write like this:

attr.mandatory := tdsls401.orno IN "^SX" or tdsls401.orno IN "^SP" or tdsls401.orno IN "^SA", 1

But then this goes beyond 60 characters....How can I shorten this string?

regards,

Jatin

Hitesh Shah
3rd July 2009, 16:08
Try following expression (considering right aligned project) .


attr.mandatory := (tdsls401.orno IN " *S[XPA]" ), 1


Do u get bw error for expression or logical error .

baan.kmurali
7th July 2009, 14:44
hitesh shah is correct. his idea will work fine.but we are doing at standard, so is it create problem at future?

Hitesh Shah
7th July 2009, 19:06
Standard may be copied to custom VRC which needs to be taken care off at the time of upgrades/ migration . This is purely a policy decision in which consistency and awareness is very important .

PrinceUK
9th July 2009, 18:01
User-definable input field validation was an Enhancement Request put in by the Baan User Group some time ago. I understood it was accepted by Infor. However, when it will ever appear and in which Baan/LN versions is another matter ................