I have a subfile that displays sales order records. If the order is a direct ship, the order number is displayed in turquoise. The color is controlled by an indicator that is set on when the records are loaded to the subfile. The subfile record is defined with keyword SFLNXTCHG and the user has options that can be entered for each subfile record.
As the option on each changed record is processed, the subfile record is updated to clear the option. The problem is I lose the color attribute in this update process. In researching this, the most recommended solution is to have a hidden field on the subfile rec that I could use to track the status of the color attribute.
I am wondering if this is still the best way or if there is a newer way to handle this issue.
Software/Hardware used:
IBM iSeries V6R1
ASKED:
May 31, 2011 8:55 PM
UPDATED:
June 1, 2011 12:45 PM
I agree.
I have always used Hidden fields for this type of problem.
By using a hidden input/output field to hold the type, you get the type back when you read the subfile record. You don’t need to perform any extra logic to determine if the subfile record represents a “direct ship” nor any other type. The determination was made before the subfile record was first displayed and can be used again if that record is updated.
Of course, if there is no significant complexity to making the determination, then it might just be simpler to make the determination each time to set the indicator on or off. It could reduce the code since it still needs to be done no matter what and there would be no use for a hidden field.
Tom
If we are reloading the subfile, then we should have an indicator for identifying the Record status. It will be fine to have a indicator at each record level(ideally Hidden field in subfile).
But, If we are not reloading the subfile and we are using only ‘Update’ then, Hidden field will not be much useful.
You could just load records with the colour attribute prefixed to the field content. This moves the logic to the RPG, is simple and obvious to anyone subsequently maintaining it.
At present, you have something that sets the indicator – just use the same code to prefix the data with the colour byte.
That way, there’s nowhere for anything to get lost.
Thanks everybody for your input.