Set sequence dynamically

samantha_sana

Well Known Member
we have a requirement to sequence the fields of a report dynamically based on customer number.
Each customer have different sort order.
The sort order is stored in a seperate table using customer number and sequence number.
The idea is to achieve this through set user sequence but there is a challenge while using set user sequence
we do not want to create new version for each customer with different sequence as number of cutomers may increase in future.


steps

1.Use table i/o to fetch the 'field to sort' and 'sort order' using while loop
2.assign the fetched field in set sequence system function

The issue here is based on the fetched value from the table i/o how to identify which BC column to map in the set user sequence system function

will writing an if condition to check the value of the 'field to sort' with a constant value before set user sequence is the only option or
do we have any better options to achieve this.

Please provide your thoughts and let me know if you need more inputs.
Thanks
 
I am confused about the relationship between the customers table and the sequence table. A couple of ideas come to mind based on my 'understanding'.

1) join your main table to the sort order table - that will allow you to specify a sort order table column in your sequencing.

2) make this a 2-step process. Step 1: gather the info you need into a workfile that contains all the data you need to perform Step 2: use the workfile as input to your report.


It would be easier to help you if we got a better idea of the structure and use of the sort table to which you refer. The confusion I have is because of your reference to dynamic column names...I am not visualizing the relationships between your customers table and the sort table.
 
I have done this before by using the system function
SetUserSequence
It works the same as the SetUserSelection in terms of the way you construct it.
I had 3 If statements controlled by a PO value that would determine which sequence I would generate.

So in your case I guess you could just have a set of records in your control table and then read them from there on an index to get the correct order as you construct the sequencing

Here is the JDE spiel on it:
SetUserSequence provides users with a method of conditionally modifying data sequencing for a section. This system function allows users to utilize ER to determine whether or not to make changes. This works in conjunction with the data sequencing for a section set up through RDA. Users should call SetSequenceAppendFlag prior to calling this function to determine whether to replace or append to the existing data sequencing information for this section.
 
Back
Top