How to give SetFilter/SetRange on Line No.

yukonyukon Member Posts: 361
Hi Expert,

I want to give Setfilter or setrange at sales line table. My setfilter/setrange is base on "Line No.".
// Sales Line
// User Selected Line
// Return Selected Line No.
CurrForm.SETSELECTIONFILTER(l_recSalesLine);
LineCount := l_recSalesLine.COUNT;
IF LineCount > 0 THEN BEGIN
  l_recSalesLine.FIND('-');
  WHILE LineCount > 0 DO BEGIN
    LineCount := LineCount - 1;
    l_recSalesLine.MARKEDONLY(FALSE);
    l_intFirstLine := l_recSalesLine."Line No.";
    l_intLastLine := l_intFirstLine;
    l_blnMore := (LineCount > 0);
    WHILE l_blnMore DO
      IF l_recSalesLine.NEXT = 0 THEN
        l_blnMore := FALSE
      ELSE
        IF NOT l_recSalesLine.MARK THEN
          l_blnMore := FALSE
        ELSE BEGIN
          l_intLastLine := l_recSalesLine."Line No.";
          LineCount := LineCount - 1;
          IF LineCount = 0 THEN
            l_blnMore := FALSE;
        END;
    IF l_codSelectionFilter <> '' THEN
      l_codSelectionFilter := l_codSelectionFilter + '|';
    IF l_intFirstLine = l_intLastLine THEN
      l_codSelectionFilter := l_codSelectionFilter + STRSUBSTNO(l_Text0001,l_intFirstLine)
    ELSE
      l_codSelectionFilter := l_codSelectionFilter +  STRSUBSTNO(l_Text0001,l_intFirstLine)
                              + '..' +  STRSUBSTNO(l_Text0001,l_intLastLine);
    IF LineCount > 0 THEN BEGIN
      l_recSalesLine.MARKEDONLY(TRUE);
      l_recSalesLine.NEXT;
    END;
  END;
END;
EXIT(l_codSelectionFilter);
//
CurrForm.SETSELECTIONFILTER(p_recSalesLine);

// Button OnPuch
g_codFilter := CurrForm.SalesLines.FORM.GetSelectionFilter;
g_recSalesLine.SETRANGE("Document No.",g_codSOrderNo);
g_recSalesLine.SETRANGE("Line No.",g_codFilter); ---> This portion can't use, Line No. Integer


My Setfilter/setrange is base on user selected. But line no is integer return is code.
I give return value is code because of sometime line no are '10000...30000' or '10000|40000'.

How can i give filter by user selected line no? Please give me sugge:

Thanks And Regards,
Yukon
Make Simple & Easy

Comments

  • garakgarak Member Posts: 3,263
    g_recSalesLine.SETRANGE("Line No.",g_codFilter); ---> This portion can't use, Line No. Integer

    Ok, your function is based, for example, on the function GetSelectionFilter() in form 22. OK, no problem. The function is ok. You find out, that the setrange command requ. an integer variable, because the field to filter is integer.

    But, why do you not use setfilter(FIELD,STRING) command?
    g_codFilter := '10000...30000|50000..70000'
    g_recSalesLine.SETfilter("Line No.",g_codFilter);
    

    so, your filter work
    Do you make it right, it works too!
  • yukonyukon Member Posts: 361
    Hi garak,

    I got it. Thx 4 your help,

    Regards, :whistle:
    Make Simple & Easy
  • garakgarak Member Posts: 3,263
    no problem
    Do you make it right, it works too!
Sign In or Register to comment.