Protect if not empty (AREV Specific)
At 09 DEC 1998 07:56:39AM Tony Smisovsky wrote:
In a WINDOW I need to protect a field, if the record allready has a (nonempty) value in that field.
Is there a way to fix this with the help of flags (protect,skip) or do I have to write PRE PROMPT command, that walks to next (previous) prompt depending on the previous prompt.
How can I distinguish between the value in the field in a record in the file from the value just entered in the WINDOW ?
Thanks Tony.
At 09 DEC 1998 08:32AM Matt Sorrell wrote:
If you include window_common%, then you have access to a variable called wc_orec%. This is the original record as it was read from disc. Compare that to @record, and the differences are what have been entered at the window.
As far as protecting the prompts on a window if there is data in them, you could do a post read process that loops through all of the prompts on the window and tests the value (wc_is% I think) of that prompt. If there is a value there, then set wc_si%(nn)=P' where nn is the prompt number. This is the same as flagging the field protected at design time.
Matt Sorrell
At 09 DEC 1998 02:19PM Tony Smisovsky wrote:
Hi Matt.
Thanks.
I checked the second part of your advise.
The wc_is% holds value of current prompt.
The wc_si% holds attributes of current prompt.
Fortunattelly I only want to protect the prompt nr 5 in my window, so I can test the value of corresponding field and do not need wc_is%
Since I am using AREV.COMMON, I tried to use PROMPTS for manipulating prompt attributes. I found out that PROMPTS is not an array, but @FM delimited string. So instead of wc_si%(5)=P' I wrote:
PROMPTS=P'
But the window did not care about the P anymore (the prompt nr. 5 was not protected).
Have you an idea?
Regards Tony.
At 09 DEC 1998 04:03PM Matt Sorrell wrote:
Tony,
The PROMPTS array is MATPARSEd into the W() array. So, if you want to change the prompt attributes for the 5th prompt to (P)rotected, then your code would look like this:
W(5)=P"
This is how I have it in my code (3.12) and it works great. Just a quick note on which prompt to protect though. The W() array doesn't go by which FMC in the record it is (i.e @RECORD), it goes by the prompt order. The best way to determine this is to press SHIFT-F7 from PAINT to display the prompt order. The number next to the prompt you want to protect is the number you need to use in code.
If you have any other questions, feel free to ask.
Matt Sorrell
At 10 DEC 1998 07:33AM Tony Smisovsky wrote:
BINGO !!!!
Thanks.