× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Patrik,

in addition to what Jon already wrote about overlaying the subfile record fields with arrays ... and about avoiding columnar code like the plague ... I have another completely counter-intuitive idea.

On Feb 22, 2024, at 4:31 AM, Patrik Schindler <poc@xxxxxxxxxx> wrote:

I'm contemplating about optimizing code for a calendar display showing a whole year.

Each month is a row of a subfile, and one subfile line has fields named DF_DAY01 to DF_DAY31, type char with two positions. This saves indicators for various highlighting purposes (only 31 needed instead of 365).


Change the subfile to 1 day per record and spread it across the display with the SFLLIN keyword.

With SFLLIN you specify the number of spaces horizontally between the subfile records. The records (record numbers) would be distributed on the screen like that:

01 13 25 37
02 14 26 ...
03 15 27 ...
...
11 23 35 47
12 24 36 48

As you see, the subfile is "populated" vertically first, with overflow to the right. The whole subfile for 12 months and 31 days per month would be 372 records. This would mean, that you need to conditionally ND+PR (or SFLRNA) the days at the end of the month, that don't exist (like April 31st).

But you would need only ONE set of indicators for that single field in the subfile records - and you would have to calculate the correct record number for a given date:

sflrrn = month + (day - 1) * 12;
e.g. December 4th = 12 + (4 - 1) * 12 = 48 (see above)

Or more simply do an outer loop for the day part from 1 to 31 and an inner loop from 1 to 12 for the month part. Then write 1 record out for each day after populating the field and the indicators.

To calculate back the date from the subfile record, I would make my life easy, and store the date in the subfile record in a hidden field.

This would be my preferred solution - completely without array and multiple indicator groups per record.

HTH and kind regards,
Daniel

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.