Quantcast
Channel: Microsoft Dynamics NAV Forum - Recent Threads
Viewing all articles
Browse latest Browse all 29197

Specific record value not displaying (CASE within IF statement)?

$
0
0

Hello geeks,


We have created an 'anomaly header' table which contains the anomalies for certain temp and posted documents. Now we need to add a button to the 'anomaly list' page to display the documents which are linked to the anomaly (Display the posted document types IF exists; ELSE display the temporary document types; If none exists, display an error message)..

The case for the 'posted document type' works fine. but the case for the 'document type' doesn't display anything (doesn't show any compilation error too). Can anyone find why the case for the 'document type' doesn't function in the below code?


IF pDocPosted THEN BEGIN
  MESSAGE('After IF');
  CASE pAnomalyHeader."Posted Document Type" OF
    pAnomalyHeader."Posted Document Type"::"Sale Shipment" : BEGIN
      IF lSalesShptHeader.GET(pAnomalyHeader."Posted Document No.") THEN BEGIN 
        lPostedSalesShpt.SETRECORD(lSalesShptHeader);
        lPostedSalesShpt.RUN;
      END;
    END;
    pAnomalyHeader."Posted Document Type"::"Sale Invoice" : BEGIN
      IF lSalesInvHeader.GET(pAnomalyHeader."Posted Document No.") THEN BEGIN
        lPostedSalesInv.SETRECORD(lSalesInvHeader);
        lPostedSalesInv.RUN;
      END;
    END;
  END;

  //To add case for more posted document types ..
END ELSE BEGIN
  CASE pAnomalyHeader."Document Type" OF
    pAnomalyHeader."Document Type"::"Sales Quote" : BEGIN
      IF lSalesHeader.GET(pAnomalyHeader."Document Type", pAnomalyHeader."Document No.") THEN BEGIN
        lSalesQuote.SETRECORD(lSalesHeader);
        lSalesQuote.RUN;
      END;
    END;
    pAnomalyHeader."Document Type"::"Sales Order" : BEGIN
      IF lSalesHeader.GET(pAnomalyHeader."Document Type", pAnomalyHeader."Document No.") THEN BEGIN
        lSalesOrder.SETRECORD(lSalesHeader);
        lSalesOrder.RUN;
      END;
    END;
  END;

  //To add case for more temporary document types ..
END;

Added the blow code in the action button of the 'anomaly list' page

lAnomalyHeader.INIT;
IF lAnomalyHeader.GET("No.") THEN BEGIN
  lAnoMgt.DocumentDis(TRUE, lAnomalyHeader);
END;

Thank you in advance!


Viewing all articles
Browse latest Browse all 29197

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>