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)

Query - select whole object instead of specific columns

(0) ShareShare
ReportReport
Posted on by
Hi, 

I've written this C/AL code to query dimensions from the database and for each
dimension I query its dimension values. The queries work as expected, I use
'MESSAGE' function to display and test values - it's fine. The problem is that I
need to pass the dimensions and dimension values to a code unit and I'd like to
pass them as objects, instead of arrays of string (using Array .NET interoperability)
- for each specific property I must have different array and it's not practical for me.
So here is my C/AL code, can you give me a piece of advice how to proceed?

FOREACH CurrentDimensionTemp IN DimensionNamesArray DO BEGIN DimensionsQuery.SETFILTER(Code, '=' + CurrentDimensionTemp.ToString()); DimensionsQuery.OPEN(); WHILE DimensionsQuery.READ DO BEGIN DimensionValuesQuery.SETFILTER(Dimension_Code, '=' + DimensionsQuery.Code); DimensionValuesQuery.OPEN(); WHILE DimensionValuesQuery.READ DO BEGIN MESSAGE(DimensionsQuery.Code + ' : ' + DimensionValuesQuery.Code); END; END; END;

Thanks!

*This post is locked for comments

I have the same question (0)
  • mmv Profile Picture
    11,471 on at

    Hi,

    Could you mention your requirement?

  • Community Member Profile Picture
    on at

    Hi,

    I need to pass my dimension and dimension values to Consolidation Import/Export XMLPort through Consolidation code unit (432) and to export them in XML format along with default consolidation export.

  • mmv Profile Picture
    11,471 on at

    Hi,

    You may write the data in an XML file and pass it.  But 432 Codeunit expects a record of "Business Unit" or are you planning to use a specific function from CU 432?

  • Community Member Profile Picture
    on at

    Yeah, I'm planning to use ExportToXML function from the 432 Codeunit to export my dimension and dimension values along with the rest of the xml structure (because 432 Codeunit sets things like glAccounts, etc...).

  • Verified answer
    keoma Profile Picture
    32,729 on at

    create a new global function in your codeunit. declare one or two paramters of type record and subtype dimension/dimension value for the function, set the paramters as VAR paramter. so you can pass a single or a set of records to your function.

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