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 10/11/19, 4:06 PM

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 10/14/19, 9:25 AM

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

Nuno Roboredo
on 10/14/19, 11:18 AM

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 10/14/19, 1:36 PM

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 10/14/19, 2:04 PM

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 10/14/19, 2:14 PM

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 10/14/19, 3:45 PM

1
Maksym Hrytsko
On 10/11/19, 4:26 PM

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 This 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: 10/11/19, 3:29 PM
Seen: 127 times
Last updated: 10/13/19, 6:10 PM