Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inventory Details sequence number -Solved-
#1
I noticed that if you change line positions on a master-detail module, the order of associated inventory details does not change(although the sequence number it's correctly updated). I don't know how this can be achieved using the interface tools, i think if it is even possible it needs to be done in the internal logic when the relations are updated. Left as it is it creates a mess on a gendoc template given the fact that the 'for each inventorydetails' loop scans the inventory details in a linear mode and you can't scan that list sorted on sequence number for example. so in the end the list that you get from gendoc differs from what you see on the module in terms of line positions.
Reply
#2
I understand that you are saying:

- 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
Joe
TSolucio
Reply
#3
(06-19-2020, 09:20 AM)joebordes Wrote: I understand that you are saying:

- 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
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 Wink.
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!
Reply
#4
Very happy :-)

Have a wonderful weekend!
Joe
TSolucio
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)