Multi Views of a subfile

475 pts.
Tags:
RPG ILE
Subfile
I need to write a program that shows more than one way to display a subfile. Both views are of the same file but sorted differently and show different fields of the same file when the user presses a function key. Can I do this in one program or do I have to make 2 seperate programs and toggle between the two? Some code examples would be helpful. Thank you in advance.

Answer Wiki

Thanks. We'll let you know when a new response is added.

I think you’ll need a seperate subfile record and control for each layout.
You an put the data into an array of data structures and sort as needed then loop through the data structure to load the array(s). You could also use different SQL statements to get the data in different orders, or different logical files. Lots of choices.

Phil

Discuss This Question: 9  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Vatchy
    You can do this with a page-at-a-time subfile. That allows you to condition the fields to display or not display. Along with this use embedded SQL to define your sort using the Prepare/Execute statements.
    1,410 pointsBadges:
    report
  • Sloopy
    Actually, you can do it in one subfile, and it can be self-extending. The subfile has a single displayable line, and the subfile control has a field or fields to show the (variable) column headings. Fill the single display field from the data, set the correct heading values and display the subfile. If the user changes the view, reload the subfile with the different data, formatted into the single display field, change the column headings and display the subfile. I use this quite often, and it's especially useful when there are different views of the same selected data, because then you can store the alternate views in hidden fields in the subfile record. When the user toggles the view (for the same selection criteria), we copy the hidden data (already formatted) to the displayable field, change the column headings and redisplay - without re-reading the database. (Of course, check the volatility of the data! You may have to reload to keep the screen up-to-date.) Sloopy
    2,195 pointsBadges:
    report
  • filuphaze
    Thanks everyone for your input. I will give some of those ideas a try and see which works best.
    475 pointsBadges:
    report
  • philpl1jb
    Sloopy The long character field is a great idea but just for output fields. And the Hidden fields work well. Whwn the alternate format key is pressed the code should loop through all the records in the subfile Chaining into each on the RRN building the new character field from the hidden fields and then updating the subfile record. Vatchy My experience was that the No Display fields still took real estate, hiding any other column in the same space. Please let me know if there is a solution. Phil
    51,365 pointsBadges:
    report
  • Splat
    I've created multiple view subfile programs. I use page-at-a-time processing & different logical views for presentation (I use RRN-chaining against the physical, storing the RRN in a hidden field in the subfile), & use a combination non-display subfile / data queue to store & sort options.
    7,665 pointsBadges:
    report
  • Vatchy
    Philpl1jb Don't use NonDisplay fields, just condition the fields to show/not show with indicators. This only works with page-at-a-time subfiles, not with extendable/load-all subfiles.
    1,410 pointsBadges:
    report
  • philpl1jb
    Thanks Vatchy I'll add that to my tool set. Phil
    51,365 pointsBadges:
    report
  • PY
    You can display multiple formats by using indicators, you need to have logicals based on the key that you wanted to display and need to play with the indicators in the program. You need to use one long character field, hidden fields in the subfile format. Lets say, when Indicator X{25} is on, display subfile in one format and when it is off display subfile in other format. Like this, you can display subfile with multiple ways......
    60 pointsBadges:
    report
  • Kathan
    Its very simple buddy, Use window subfile , that is two different window and write subfile and exfmt other one. IN display file, create a field of any lengh with same name in both window of NON DISPLAY type, Now call your program, you will see two window and when you press TAB, it will jump to other window and it will show the records.
    70 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following