web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Sql to nav page(Microsoft Dynamics NAV)

(0) ShareShare
ReportReport
Posted on by 69

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 can't filter properly. What am I missing? I am a beginner btw

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Hannes Holst Profile Picture
    5,767 on at

    Hi,

    for what exactly do you want to apply a filter?

    Alternativly, you could do something like this also:

    PurchInvLine.SETRANE(Type, PurchInvLine.Type::"G/L Account");
    PurchInvLine.SETFILTER("No.", '122350*|122370*|7*');
    IF PurchInvLine.FINDSET THEN
      REPEAT
        // processing of PurchInvLine-records here
    Rec := PurchInvLine; INSERT;
    UNTIL PurchInvLine.NEXT = 0;

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
HoangNam Profile Picture

HoangNam 7

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans