web
You’re offline. This is a read only version of the page.
close
Skip to main content
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
    60,939 Super User 2025 Season 2 on at
    RE: How assign array value to normal variable?

    Please check variable column No.

    try to use without spaces and .

  • ManishS Profile Picture
    86 on at
    RE: How assign array value to normal variable?

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

    Can you share the screen shot of the code.

  • mmv Profile Picture
    11,471 on at
    RE: How assign array value to normal variable?

    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;

  • Community Member Profile Picture
    on at
    RE: How assign array value to normal variable?

    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

  • Community Member Profile Picture
    on at
    RE: How assign array value to normal variable?

    Hi Mohana,

    I am getting at compile time.

    Thank you

  • mmv Profile Picture
    11,471 on at
    RE: How assign array value to normal variable?

    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

  • Suggested answer
    Mohana Yadav Profile Picture
    60,939 Super User 2025 Season 2 on at
    RE: How assign array value to normal variable?

    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);

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
Saurav.Dhyani Profile Picture

Saurav.Dhyani 2 Super User 2025 Season 2

#2
RK-25090803-0 Profile Picture

RK-25090803-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans