|
Hi Sumit, With field selection subfiles, all fields are checked for valid values for that data type, whether you opt to display them or not. When you are writing lines to the subfile I would recommend that you write default values to all fields you are NOT displaying to ensure that this problem does not occur. I would say that you would probably get away with simply defaulting the date field to *loval when not displaying it. This is the only difficulty with validating "panels" built in this way - every time you read a record from the subfile you retrieve a copy of all subfile fields, whether you populated them or not. This causes any values you had from the previous record to be overwritten. When cross-validating field values, things get complicated by this process. Here's a simple example of the cross-validation problems you can get: The subfile will either display a 1-byte alphanumeric or a 2-byte zoned decimal (with zero decimal places). Field1 - 1a conditioned on *IN73 Field2 - 2s,0 conditioned on not *IN73 You write the subfile: // Write record 1 - displaying the alphanumeric... *IN73 = *on; Field1 = 'A'; Field2 = *zeros; RRN = 1; Write sfl1; // Write record 2 - displaying the zoned decimal... *IN73 = *off; Field1 = *blanks; Field2 = 3; RRN = 2; Write sfl1; // Display subfile... Exfmt ctl1; Assuming both fields have the same starting position on the subfile, your display will show Field1 (with value = 'A') above Field2 (with value = 3). Now, imagine that, if th euser enters a value in Field1 (not blank) there MUST be a non-zero value in Field2. As we can see from the example above, the values we have should be OK. Now, let's read the subfile, line-by-line to perform some checks... When you chain to subfile with RRN = 1 Field1 has a value of 'A', but Field2 has a value of *zeros - you effectively "lose" the Field2 value in record 2 when retrieving the Field1 value in record 1 because you also retrieve the non-displayed Field2 value from record 1. This is where you are getting your problem with the non-displayed date field. This is also where the most common difficulty with cross-validation in field selection subfiles arises - whenever working with multiple variables across multiple lines and trying to validate them against each other you only really have a partial picture when chaining to each row. You need to retrieve ALL field values into work fields before cross-validating the data. So, in your case this may not be a problem, but be aware that it is sometimes necessary to have separare copies of each subfile field defined in the program (either within a DS or as standalone fields). You then retrieve each "displayed" value from the subfile and populate these fields. Cross-validation is then performed against these fields, "as if" they were panel fields used in the display file. Of course, failed validation presents it's own problems as you need to "know" where the panel fields really exist within the subfile so you can re-chain to the subfile and set on any Reverse Image or Position Cursor display attributes. Again, in your case, simply setting the date to an appropriate value should prevent any problems - you can even use the current date. As you should never retrieve the value to work with when the field is non-displayed it doesn't really matter what date is within it. I expanded my answer to include the issues arising from cross-validation as I think it highlights the "mindset" you need to employ when working with field selection subfiles - the panel must be treated as multiple copies of itself, each copy a slice of screen displaying one or more of the fields. It is the composite of all these slices which is displayed on the screen. But always be aware that every field is there on every line, whether you can see it or not. I hope this makes sense, and is of help to you. Cheers Larry Ducie
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.