Sql to nav page

sjensjen Member Posts: 53
edited 2019-04-16 in NAV Three Tier
Hi,
I have a sql statement and my client runs this sql monthly basis and he decided that he wants this in nav. I created a temp page and a report for them to enter a date range(request page) then i want to display but I can't display the way I want.

for example here my sql statement
dbo.[Companyname$Purch_ Inv_ Line].No_ LIKE '122350%' OR
dbo.[Companyname$Purch_ Inv_ Line].No_ LIKE '122370%' OR
dbo.[Companyname$Purch_ Inv_ Line].No_ LIKE '7%')

My solution is
IF PurchInvLine.FINDSET THEN
      REPEAT
      IF (Type = Type::"G/L Account") AND 
        ((COPYSTR("No.",1,6) IN ['122350', '122370']) OR // Problem is here I know. If I don't have anything here I can display everything
         (COPYSTR("No.",1,1) = '7'))
      BEGIN
          // Populate Temp Table //
          Rec := PurchInvLine;
          INSERT;
        END;
      UNTIL PurchInvLine.NEXT = 0;
  UNTIL PurchInvHeader.NEXT = 0;

I can do the rest but I cant filter properly. What am I missing? I am a beginner btw

Best Answers

  • RockWithNAVRockWithNAV Member Posts: 1,139
    Answer ✓
    @sjen Between SETRANGE and SETFILTER you should always give priority to SETRANGE.

    COPYSTR will anyhow you have to do looping and SETFILTER will save you from this so SETFILTER holds the priority. :smile:

Answers

Sign In or Register to comment.