varient.iscode function

apg1apg1 Member Posts: 8
edited 2004-01-22 in Navision Attain
i have one query......................
i am trying to use (varient variable).iscode function as follows........

AField := TableFields.Item(2);
Cust := AField.Value; // Cust is of type varient
//MESSAGE('%1',Cust);
IF Cust.IsCode THEN
JobBudgLine.Customer := Cust;

JobBudgLine.insert;

customer field is of type 'varchar' in another database......
i am pulling that value in Navision with Cust ( varient ) variable...
i am using cust.iscode b'coz, if customer is blank, it gives error
but after using cust.iscode it doesn't go into the if statement , and doesn't insert in JobBudgLine
can anybody guess why this is happening ?

Comments

  • awarnawarn Member Posts: 261
    You could try this, I have not used the IsCode function before:

    AField := TableFields.Item(2);
    Cust := AField.Value; // Cust is of type varient
    //MESSAGE('%1',Cust);
    //IF Cust.IsCode THEN
    //JobBudgLine.Customer := Cust;
    JobBudgLine.VALIDATE(Customer, Cust); //new line here

    JobBudgLine.insert;


    The VALIDATE function will uppercase the variant if necessary, even if there is no code under the validate trigger. The only problem that you will get with a blank is if this field is required.

    Hope it helps,

    -A
  • apg1apg1 Member Posts: 8
    JobBudgLine.VALIDATE( JobBudgLine.Customer, Cust);

    this gives rise to recursive function calls and hense stack full error
Sign In or Register to comment.