Welcome!

This community is for professionals and enthusiasts of the Genio platform.
Share your questions and challenges, and help your partners!

3

1
Rodrigo Serafim
On 11/10/2019 下午4:06

The 'write condition' is a validation rule. It will only run when the user presses the save button in the form. So its an expected behavior for the field to be open.

To block the field from being edited you can hide it or you can block it. These rules can be specified in the 'Show When' and 'Disable When' respectively in the table field specification. The 'Fill When' has the additional property of clearing the value of the field when the condition is false, so it should be used with care.


In the form field specification only the 'show when' is available. Its best practice to think about these kind of business rules in terms of the business entities, not in terms of the form interface. Business rules should be as traversal as possible throughout the application to avoid data and interface inconsistencies (if the user is able to do operation X in one interface, the same user should be able to do operation X in any interface).

  • Flag

"The 'write condition' is a validation rule. It will only run when the user presses the save button in the form."

However, when the user press the save button in the form, it saves the information normally, ignoring that the "write condition" is false.

In my case, I need to put an expression to verify if the logged user is the "owner" of the "Observação" (not just "0==1". I seted this expression only to verify that the 'write condition' is not working in single fields of a form)

Nuno Roboredo
on 14/10/2019 上午9:25

The expression that I want to set in "write condition" in this field is [ANALI->CODPESS6]==GetEph("USER")

Nuno Roboredo
on 14/10/2019 上午11:18

The field [ANALI->CODPESS6] is specified with "DG Default (once)" and GetEph("USER") and it works nicely: when a new record is created in the "ANALI" table, this field is filed with the user logged.

When I set the 'Disable When' in the table field specification with the condition [ANALI->CODPESS6]!=GetEph("USER"), it disable the field in all situations whatever the field [ANALI->CODPESS6] have the logged USER or not.

But if I set the condition [ANALI->CODPESS6]==GetEph("USER"), it enable the field in all situations whatever the field [ANALI->CODPESS6] have the logged USER or not.

Nuno Roboredo
on 14/10/2019 下午1:36

The definition seems correct, hard to tell more without going into debug. Assuming the "USER" is in context when the form is opened and its indeed the same value, then it can be a failure of the comparison operator.

Try to apply the KeyToString function to both sides in order to normalize the inputs:

KeyToString([ANALI->CODPESS6])!=KeyToString(GetEph("USER"))

Let me know if it works this way.

Rodrigo Serafim
on 14/10/2019 下午2:04

However, if I set the "Write condition" in the table field specification (not in the form specification) with the same condition [ANALI->CODPESS6]==GetEph("USER"), it works as expected

Nuno Roboredo
on 14/10/2019 下午2:14

With KeyToString([ANALI->CODPESS6])!=KeyToString(GetEph("USER")) in the field 'Disable When' don't work: the field remains enabled whatever the user.

The opposite condition: KeyToString([ANALI->CODPESS6])==KeyToString(GetEph("USER")) have the same behavior: the field remains enabled whatever the user.

Nuno Roboredo
on 14/10/2019 下午3:45

1
Maksym Hrytsko
On 11/10/2019 下午4:26

At this time only the "Write condition" defined in the table field is supported and is validated on the server side in the save process.

If you need to block the field forever just on this form, I would recommend changing the help type to "Fixed".


Also, if you need to block the field on all forms, based on a condition, you can use the "Disable when" condition in the table field.



Keep Informed

About the Community

This platform is for beginners and experts willing to share their Genio knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers. Read Guidelines

Question tools

12 follower(s)

Stats

Asked: 11/10/2019 下午3:29
Seen: 1904 times
Last updated: 13/10/2019 下午6:10