How to modify a data master value incremented up by 1 using a variable?

Zane Winberg shared this question 5 years ago
Answered

I have a need where I want to update (modify) a data master called SystemNumbers, that has two Fields, one called Table_Name and the other called Next_ID.


I wish to update the 'Table_Name.RepairOrders' row's... Next_ID value with an increment of +1. (from it's value of '5001' (which is my current set value on the variable 'varRepairOrder_ID') to a new value of '5002' when I click a button. I have the button and here's my expression that's not working for some reason:


executes modify(select(SystemNumbers, (Table_Name = 'RepairOrders')), Table_Name = 'RepairOrders', Next_ID = (varRepairOrder_ID + '1')) 6308e58db34d63b3f84ad5a5aab2d21d

Comments (6)

photo
1

The expression seems to be fine but for one thing. Instead of a 'select' function you need to use a 'filter' function. 'Select' returns texts, 'Filter' return rows.

photo
1

Thank you Victor... that works to update the instance when I simulate (which I can verify with this expression: Select(Filter(SystemNumbers,(Table_Name=RepairOrders)),Next_ID) on a label to see that it is now 5002). However, it is not actually updating the Next_ID in the data master. So that when I exit the simulation, it still has a value of 5001. Am I missing something? Thanks again.

photo
1

Just remember the changes you do in simulation are not persistent. That means when you launch the simulation, all values are reset to the ones specified in the data master.

photo
1

Is there a work around for this? I guess that I am misunderstanding the purpose of new, modify delete on a data master. That it only works on datagrids? Is there not a way to modify values on a data master? Thanks again.

photo
1

Was this a bug in a prior version perhaps? I was looking at this problem (Data masters and data grids) reported 9 months ago as 'solved'. Sorry, just confused by how this works to keep updated values in the data master.

photo
1

It's hard to see what's the problem with your prototype this way. Would you mind to send it to jim.support at justinmind.com so we can take a look at it?