NAV C/AL Coding Question – Lookup on a Report Request Page

  • NAV C/AL Coding Question – Lookup on a Report Request Page

    Posted by Lewis Rosenberg on March 9, 2018 at 11:55 am
    • Lewis Rosenberg

      Member

      March 9, 2018 at 11:55 AM

      ?

      Hi Everyone.

      Ā 

      I could use some C/AL help.

      Ā 

      I have a table and the first two fields, SubjectID (Code 20) and Issue (Text 20), make up the Key.

      Ā 

      So the data might look like this:

      Ā 

      SubjectIDĀ Ā  Issue

      ======== =====

      SOP-100Ā Ā Ā Ā  New

      SOP-100Ā Ā Ā Ā  1

      SOP-100Ā Ā Ā Ā  2

      Ā 

      I have a report with a request page. On the request page, there is a lookup to the table to select the SubjectID and Issue.

      The lookup places only the value of the SubjectID into the lookup variable. How can I get it to also grab the value of the Issue field?

      #NAV2013R2
      #DeveloperorDBA

      ??

      ——————————
      Lewis Rosenberg
      IT Manager
      Mars Fishcare
      Chalfont PA

      NAVUG Board of Advisors, Programming
      NAVUG Programming Committee
      NAVUG Membership Committee
      ——————————

    • Franz Kalchmair

      Member

      March 9, 2018 at 4:16 PM

      your table’s is e.g. table50000.
      add a list page on base of that table, add the object no. of the page in table propertiesĀ LookupPageID,DrillDownPageID.

      in the request page you use a glob. var. e.g.Ā subid. in the req. page line do not set a table relation.
      add following code in theĀ subid – OnLookup trigger:
      IF PAGE.RUNMODAL(0,table50000) = ACTION::lookupok THEN
      subid := table50000.SubjectID + ‘-‘ + table50000.Issue;

      ——————————
      Franz Kalchmair
      Microsoft MVP
      Senior Consultant
      Vienna, Austria, Europe
      ——————————
      ——————————————-

    • Lewis Rosenberg

      Member

      March 12, 2018 at 10:30 AM

      ?Thank you !

      That was a great help.

      ?

      ——————————
      Lewis Rosenberg
      IT Manager
      Mars Fishcare
      Chalfont PA

      NAVUG Board of Advisors, Programming
      NAVUG Programming Committee
      NAVUG Membership Committee
      ——————————
      ——————————————-

    • Val Gameiro

      Member

      March 12, 2018 at 10:42 AM

      When you’re looking up on a field, you can only retrieve one value, hence the code workaround.

      Another option, although perhaps not as elegant, would be to add a combination field that takes both values of the key into itself, and that’s the field you would look up on (if that makes any sense).

      This is a common trick I use in PowerPivot tables or even Jet Reports sometimes.

      ——————————
      Val Gameiro
      Advanced Business Systems, LLC
      Implementer/Project Manager
      Austin, Texas
      former NAVUG Austin Chapter Leader
      ——————————
      ——————————————-

    Lewis Rosenberg replied 8 years, 1 month ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

The discussion ‘NAV C/AL Coding Question – Lookup on a Report Request Page’ is closed to new replies.

Start of Discussion
0 of 0 replies June 2018
Now

Welcome to our new site!

Here you will find a wealth of information created for peopleĀ  that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!