SBX - Search With Button

SBX - Forum Post Title

Table Issue Not initializing

Microsoft Dynamics NAV Forum

Rikarddo asked a question on 12 Jul 2018 10:58 AM
My Badges

Question Status

Verified

Imagine this scenario,

I have a table where it has values of transporting merchandise bases on the distance between two points and its quantity:

For example from Location Code 1MAI to Post Code 4520-451  transporting 2000Kg the cost is 20.

I have this code:

CASE ltShipAgent."Tipologia PricingTool" OF
  ltShipAgent."Tipologia PricingTool"::Transportadora:
  BEGIN
    oldpostcode:=PostCode;
    temppostcode:=(DELCHR(COPYSTR(oldpostcode,1,4),'=','-'));
    finalpostcode:=COPYSTR(temppostcode,1,2);
    ltTransportadoras.SETRANGE("Location Code",Location);
    ltTransportadoras.SETRANGE("Postal Code",finalpostcode);
    ltTransportadoras.SETFILTER(QtdMin,'<=%1',QtdTotal);
    ltTransportadoras.SETFILTER(QtdMax,'>=%1',QtdTotal);
      IF ltTransportadoras.FINDSET THEN
        BEGIN
          lpmin:=ltTransportadoras.Valor;
          REPEAT
            IF ltTransportadoras.Valor< lpmin THEN
            lpmin:=ltTransportadoras.Valor;
          UNTIL ltTransportadoras.NEXT=0;
         END;
      EXIT(lpmin/QtdTotal);
  END;
END;

But when i run debugger, when it enters in code, it says ltTransportadora."Location Code"= 0, and for all other variable.
I mean it's not getting any value from table.

My table key is

Enabled Key SumIndexFields
Yes Location Code,Postal Code,QtdMin,QtdMax

What is  the problem? Any thougths...?


Reply
Rikarddo responded on 13 Jul 2018 6:54 AM
My Badges

Value does not get fetched in setrange

ltTransportadoras.SETRANGE("Location Code",Location);

 lttransportadoras.SETRANGE("location Code") =0

Location gets the correct value


Not understanding why it happens. Can be a table problem?

Reply
Rikarddo responded on 13 Jul 2018 10:52 AM
My Badges
Verified Answer

Got it, my search values were out of range of my values of table. Had to optimize my table values

Reply
Rikarddo responded on 13 Jul 2018 10:52 AM
My Badges
Verified Answer

Got it, my search values were out of range of my values of table. Had to optimize my table values

Reply

SBX - Two Col Forum

SBX - Migrated JS