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)

How assign array value to normal variable?

(0) ShareShare
ReportReport
Posted on by

Hi,

I have a small issue fromdate is array variable and I have a code below

DateG := fromdate[1];

Here DateG is global variable with date data type and I am assgining fromdate value to datrg but I got an error you cannot := this for normal variable you have to assign to dimension variable only.

Why this type of error came i can't assign this fromdate array variable to normal date variable.

And I have used this fromdate [1] as function parameter it worked.

Why can't I assign to normal date variable.

One more thing fromdate is also date data type but it's an array.

Please any one suggest me.

Thank you

Ramesh

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mohana Yadav Profile Picture
    61,005 Super User 2025 Season 2 on at

    Are you getting error at run time or compile time?

    I tried this and working fine

    arraytest[1] := 010120D;

    testdate := arraytest[1];

    MESSAGE('%1',testdate);

  • mmv Profile Picture
    11,471 on at

    Hi,

    There's no issue in assigning the array variable value to a normal variable of the same type.  It works well.

    3386.ImportLicense.jpg

  • Community Member Profile Picture
    on at

    Hi Mohana,

    I am getting at compile time.

    Thank you

  • Community Member Profile Picture
    on at

    One more thing I got this error in for loop means my code is like below

    DateG := fromdate[column No.];

    When I compile i got an error you cannot assign array variable to normal variable.

    Thank you

  • mmv Profile Picture
    11,471 on at

    it still works:

    vDateArray[1] := 010117D;

    vDateArray[2] := 010217D;

    vDateArray[3] := 010317D;

    FOR lvCount := 1 TO 3 DO BEGIN

     vFromDate := vDateArray[lvCount];

     MESSAGE('%1',vFromDate);

    END;

  • ManishS Profile Picture
    86 on at

    Are you sure you are getting error at this line DateG := fromdate[1];

    Can you share the screen shot of the code.

  • Suggested answer
    Mohana Yadav Profile Picture
    61,005 Super User 2025 Season 2 on at

    Please check variable column No.

    try to use without spaces and .

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