Grey out a field on entry into a screen

SOLVED

Hi All,

am hoping someone can give me some advice on where I'm going wrong...

I have a bespoke field on the PIH1 screen that reads and writes to the db as required. What I want to happen is when I open the screen that if this field is populated and there is an invoice number to grey out the field.

The most logical action I can think of to place my relatively simple code is against the LIENS action (or the VERROU action) as I have seen this done in many places around the system, but no matter what I try, it does not work. I can get this to work just fine on various screen actions, this is not a problem, I just want it to grey the field out on loading of the screen. Here is the code I have added to SPEPIH:

$ACTION

 

Case ACTION

When "VERIF_CRE" : Gosub VERIF_CRE

When "VERIF_MOD" : Gosub VERIF_MOD

When "LIENS" : Gosub LIENS

When default

Endcase

Return

######################################

$LIENS

#Gosub LIENS From SUBPIHA

#Dbgaff

If [F:PIH]NUM <> "" & [F:PIH]YSENTAPPTO <> ""

Diszo [M:PIH1]YSENTAPPTO

Affzo [M:PIH1]YSENTAPPTO

Else

Actzo [M:PIH1]YSENTAPPTO

Endif

Return

Thanks in advance,

Joe

Parents
  • 0
    hi
    try to use Grizo instead of Diszo
    you also don't need Affzo after that.
    you also don't need Actzo as it is active by default (I think)

    another thing is that you should check that there is no code that affect this fields after your LIENS
    what about the standard LIENS? you should call the LIENS from the SUBPIH and set GPE to 1 and then call yours specific
  • 0 in reply to Barak
    Hi Barak,
    thanks for the reply.

    I started off without the affzo and added it in just in case, but will take it off as suggested. I also removed the actzo, but it had no effect. In my post there is a commented out line: #Gosub LIENS From SUBPIHA, again this did not have an effect. I will try by adding: GPE = 1 before my if statement and see if that works.

    Cheers,
    Joe
  • 0 in reply to joe0507
    Hi
    I don't understand what you are doing here:
    If [F:PIH]NUM <> "" & [F:PIH]YSENTAPPTO <> ""

    why not:
    If [F:PIH]NUM <> [F:PIH]YSENTAPPTO

    or use the [M] class?
    if [M]YSENTAPPTO <>"" then grey...
  • 0 in reply to Barak
    Hi Barak, in answer to your questions
    "I don't understand what you are doing here:
    If [F:PIH]NUM <> "" & [F:PIH]YSENTAPPTO <> "" "
    --I am testing to see if there is an invoice number and if the YSENTAPPTO field has been populated and if true, grey out my field, I could potentially drop the [F:PIH]NUM <> "" part

    "or use the [M] class?
    if [M]YSENTAPPTO <>"" then grey... "
    -- I have tried with the [M] class but it also did not work.

    I have altered my code as below, and it does grey out my field as required... but the lines do not load (standard LIENS does not seem to run), win one, lose another haha

    $LIENS

    GPE = 1

    If [M:PIH0]NUM <> "" & [M:PIH1]YSENTAPPTO <> ""
    Grizo [M:PIH1]YSENTAPPTO
    Endif

    Return

    I tried putting GPE in between the endif and return, but this had the same effect, I then tried GPE = 0 just in case this had an effect and the field did not grey out but standard LIENS did run as normal.

    :-(

    Thanks for your help so far
    Joe
  • 0 in reply to joe0507
    I'm wondering if LIENS is the wrong action to use
  • 0 in reply to joe0507
    ok, sorry for misunderstanding what you wrote.
    try this:

    $LIENS
    #call standard
    Gosub ACTION From SUBPIH
    GPE = 1
    Gosub ACTION From SPVPIH
    GPV = 1

    #do yours
    If [M:PIH0]NUM <> "" & [M:PIH1]YSENTAPPTO <> ""
    Grizo [M:PIH1]YSENTAPPTO
    Endif

    Return
Reply Children
No Data