simple coding question -> SETRANGE & Record

JKoBJKoB Member Posts: 40
Hey!

I have 2 variables called "usage" (text) & "usagedescription" (record)

"Usage" is filled with a code (e.g. "SALES")

The Table i record with "usagedescription" looks like this:
Code_______Description
SALES________For Sales only
PROD_________For production only
ALL__________General usage

Now i want NV to give me the Description of the code "SALES"

Presently i have a textbox with the sourceExpr "Usage"

What i need is a textbox which shows me the descrition.

Can anybody help me with this?

Greets, Jakob

Answers

  • kapamaroukapamarou Member Posts: 1,152
    Declare a descrTxt as a Text variable.

    Then:
    usagedescription.Reset;
    usagedescription.SETRANGE(Code,usage);
    IF usagedescription.FINDFIRST THEN
      descrTxt := usagedescription.description ELSE 
      descrTxt := '';
    


    *In case you know the Primary key you can do:

    IF usagedescription.GET(usage) THEN
    descrTxt := usagedescription.description ELSE
    descrTxt := '';
Sign In or Register to comment.