Set value for an attribute to a default number within a data grid (on leave)?

0
Hi to everyone! I do have a data grid that has the following characteristics: - the page parameter (not of the data grid, but of the whole page!) is set to entity "OU" - the data grid itself is nested within this entity "OU" and has itself "Xpath" and "PL" as Data Source, "PL" is another entity and comprises all months of the year as attributes - Now this data grid is a table, from January to December and it is editable so you directly can insert numbers when entering the page, without having to open another one The problem now is, that everytime when NOTHING is inserted (not even 0), it produces an error because I do have calculated values stored within the table. So my plan now is to set every cell of this table to "0" when NOTHING is in there, so actually that NEVER nothing can be in there ! I hope, this is understandable... As a default value, 0 is already in there but as soon as someone clicks into the cell and gets out without entering a number, it disappears, nothing is in there and the following message is shown: "An error occured, please contact your system administrator". Do you know how to set this via xpath? I'd really like to leave everything just as it is...and only fill out the conditions for that within xpath.   So I think of something like ["If January (which is an attribute of the entity PL) is empty, set it to 0"]... But may someone help me to translate it into xpath (in case it is possible..)? I am grateful for every helping answer! Regards, Laura
asked
2 answers
1

Hi laura,

If i understand your case well;

you can not use logic in your xpath, therefore you have to do it before;

in this case:

["If January (which is an attribute of the entity PL) is empty, set it to 0"]

you could do something like:

MF:  valueJan[create an integer based on the attribute of entity pl, if empty make it 0] -> use valueJan in your xpath

I wonder whether the technical implementation of a calculated attribute is the right thing here (i usually don't use it, seen the calculations will be done everywhere where the object is used, even when you don't need the updated values for the attributes, so you should consider that very well, but there are certainly cases), besides that you can also consider setting empty values to 0 in your on leave mf.

answered
1

Can't you change your calculated values to Stored('normal') attributes, and calculate them via a "before commit" eventhandler? Since a datagrid fires a commit after leaving an editable field, this should work too right?

Or am I misinterpreting your question?

 

answered