Hello guys,
I’m doing some sort of research on this right now and based on what I found already, I’m still not sure what would be the best way of implementing such functionality.
So, say I have a couple of lookup fields (Field1 and Field2), where the list of ItemIds and Qtys is shown on each of them (derived from a table). I select one of ItemIds and somewhere on a form I set the Qty I would like to use. The next time I use this lookup, I would like to see the Qty I just set somewhere in the form being subtracted from the Qty returned by lookup query.
Since the results are not committed at this point of time, I would need to use some temporary storage, such as temporary table or List, or perhaps data contract class. Initially I thought I could modify the lookup query before the results are returned, but I don’t see it how could it be done.
Would anyone be able to put me on a right direction, please?
The resources I found so far:
I’m still not sure what you’re trying to achieve. Let’s say that your Qty is 5. Do you want to subtract 5 from all quantities displayed in the lookup?
Sorry, I should have been more precise.
Ok, let’s say Field1 lookup returns a list of items and qtys next to them as:
ItemID Qty
DD010AM1N0 5
DD010AM1N1 10
DD010AM1N3 6
Now, I select first item (DD010AM1N0) and somewhere on a form (most likely on a field next to it) I enter it’s qty as 2. Later on I will do something with this user input, but at this point in time it’s not being subtracted from 5 that exist in a table.
So now, if I select Field2 and one of the items returned by lookup happens to be DD010AM1N0, it will show me the qty of 5, when I would prefer to see it as 3, that is - 2 subtracted from 5 on a previous action.
Does this make any sense?
Field1 and Field2 are using same lookup method.
I don’t think there is any good solution. You could use a temporary table, but it doesn’t seem very efficient for subtracting a value from a single row.
Maybe you can design your UI to something that can be done in an easier way.
Thank you, Martin. That’s what I thought, I mean, whatever I choose it will still look like an overkill for such a simple requirement. I just thought, because of my still limited amount of AX knowledge, there is someone who have achieved this in a simple way 
Asking is a good idea; at least you know that you didn’t miss something obvious. And who knows, maybe somebody else will come with some clever solution.