SQL Query to NAV Filter

yukonyukon Member Posts: 361
Hi Fri,

How can i convert below sql query to nav filter?
SELECT * FROM [Document Dimension] WHERE
(([Dimension Code]='A' AND [Dimension Value Code]='B') AND
([Dimension Code]='C' AND [Dimension Value Code]='D'))

Regards,
Yukon :roll:
Make Simple & Easy

Comments

  • PloegPloeg Member Posts: 70
    Where do you want to use the filter and why would you want to use the syntax in your example..?
  • DanjoDanjo Member Posts: 12
    Your query does not make to many sense.
    What are you trying to achive with this statement?
    Where do you want to filter? In code, page, report?

    Gesendet von meinem HTC Desire mit Tapatalk
  • krikikriki Member, Moderator Posts: 9,112
    yes:
    SETFILTER("Dimension Code",'%1&%2','A','C');
    SETFILTER("Dimension Value Code",'%1&%2','B','D')
    

    But you will never find a record: a "Dimension Code" can never be at the same time 'A' and 'C' (and same goes for "Dimension Value Code").

    If you mean ((A+B) OR (C+D)):
    SELECT * FROM [Document Dimension] WHERE
    (([Dimension Code]='A' AND [Dimension Value Code]='B')) OR
    (([Dimension Code]='C' AND [Dimension Value Code]='D'))
    

    than the answer is no. You need to do 2 different checks.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • yukonyukon Member Posts: 361
    Hi all,

    Thanks for your reply. Sorry for my short question. Let me explain to you what i want it.

    Using Std. DB.

    Sale No. 00002
    Sales Line
    Line No. Item Desc.
    10000 80002 xxxxxx

    Doc Dim
    Line No. Dim Code Dim Val
    10000 AREA 70
    10000 BUSINESSGROUP OFFICE
    10000 CUSTOMERGROUP MEDIUM
    10000 DEPARTMENT SALES
    10000 PROJECT MERCEDES
    10000 SALESPERSON PS

    20000 80002 xxxxxx

    Doc Dim
    Line No. Dim Code Dim Val
    20000 AREA 70
    20000 BUSINESSGROUP OFFICE
    20000 CUSTOMERGROUP MEDIUM
    20000 DEPARTMENT SALES
    20000 PROJECT MERCEDES
    20000 SALESPERSON PS

    30000 80003 xxxxxx

    Doc Dim
    Line No. Dim Code Dim Val
    30000 DEPARTMENT SALES
    30000 PROJECT MERCEDES

    Purch No 0001
    Purch Line

    30000 80003 xxxxxx

    Doc Dim
    Line No. Dim Code Dim Val
    30000 DEPARTMENT SALES
    30000 PROJECT MERCEDES

    If i hit some button i want to check Which Sale Line Doc Dim is exactly same as Purch Line Doc Dim. It is same i want to get back unit price or etc. Above a sample line 3000 only exactly same other is not. So i want to take Unit Price Of Line No. 3000.
    Kriki,

    SETFILTER("Dimension Code",'%1&%2','A','C');
    SETFILTER("Dimension Value Code",'%1&%2','B','D');

    It is show empty. And then i filter by manual also empty. Am i wrong :(

    Noted: I'll keep your suggestion.

    Regards,
    Yukon
    Make Simple & Easy
Sign In or Register to comment.