06-19-2020, 10:31 AM
(06-19-2020, 09:20 AM)joebordes Wrote: I understand that you are saying:Perfect! It works indeed. I knew you can put some field conditions on the loop, but i did not noticed it can also sort. That's just fantastic .
- the order of the master-detail inventory module is correctly managed
- the sequence number (thus the order) of the inventory details records related to the inventory module record is updated and managed correctly
- the issue is that the GenDoc foreach loop is retrieving the inventory details record in database order and not sequence field order
so there is really no problem in the code, but in the limitation of GenDoc foreach loop to get the records in a given order.
(that is why you say "i think if it is even possible")
If the above is correct try adding the "sort" directive in the GenDoc foreach
{foreach InventoryDetails *sequence ASC*}
https://github.com/tsolucio/corebos/pull/710
Let me know how it goes
And your assessment was spot on! My initial thoughts were that it was something to be used like that since there was nothing wrong in the code or databases, just an expected behavior given the nature of the loop scan... but the option to sort is already there. In fact, that addition plus what was already in there makes that loop very powerful now.
Thanks alot!