How to output full array by message?

MarharytaMykytenko
Member Posts: 53
I have an array of 10 elements. How to output this elements by message without hardcoding like:
MESSAGE(FORMAT(ArrayNumber[1]) + ', ' + FORMAT(ArrayNumber[2]) + ', '+ FORMAT(ArrayNumber[3])
+ ', '+ FORMAT(ArrayNumber[4]) + ', '+ FORMAT(ArrayNumber[5]) + ', '+ FORMAT(ArrayNumber[6]) + ', '
+ FORMAT(ArrayNumber[7]) + ', '+ FORMAT(ArrayNumber[8])+ ', '+ FORMAT(ArrayNumber[9])+ ', '+ FORMAT(ArrayNumber[10]))
MESSAGE(FORMAT(ArrayNumber[1]) + ', ' + FORMAT(ArrayNumber[2]) + ', '+ FORMAT(ArrayNumber[3])
+ ', '+ FORMAT(ArrayNumber[4]) + ', '+ FORMAT(ArrayNumber[5]) + ', '+ FORMAT(ArrayNumber[6]) + ', '
+ FORMAT(ArrayNumber[7]) + ', '+ FORMAT(ArrayNumber[8])+ ', '+ FORMAT(ArrayNumber[9])+ ', '+ FORMAT(ArrayNumber[10]))
0
Best Answers
-
Do you have the loop that builds the text inside another loop?
That's what it looks like to me.
When I use the snipped Phoge posted with an Array I filled with 1-10 it works just fine:
Could you post the codesnippets you use for filling the array and for creating the Message?5
Answers
-
Thank you for this answer,
But now I have another problem:
When I input first value it is insert the end of the text variable, so it is OK. But when I want to insert second and third, etc values next situation happening (example on the image).
So how I can produce the variant when all array values are inserting in the text without repeating?0 -
Do you have the loop that builds the text inside another loop?
That's what it looks like to me.
When I use the snipped Phoge posted with an Array I filled with 1-10 it works just fine:
Could you post the codesnippets you use for filling the array and for creating the Message?5 -
OK fine, but what parameters should get external loop?0
-
rubberducky wrote: »Do you have the loop that builds the text inside another loop?
That's what it looks like to me.
When I use the snipped Phoge posted with an Array I filled with 1-10 it works just fine:
Could you post the codesnippets you use for filling the array and for creating the Message?
What does at mean "snipped Phoge"?0 -
There should be no external loop, was my point.
Or did you just create that message to show the issue with the numbers at the wrong place and the issue isnt multiple outputs of the 10 element array.
If you post the code snippets you are using, I can probably tell you where things go wrong, could be either the array being filled incorrectly, or your code for concatenating the elements into the output string is incorrect.0 -
What does at mean "snipped Phoge"?3
-
rubberducky wrote: »There should be no external loop, was my point.
Or did you just create that message to show the issue with the numbers at the wrong place and the issue isnt multiple outputs of the 10 element array.
If you post the code snippets you are using, I can probably tell you where things go wrong, could be either the array being filled incorrectly, or your code for concatenating the elements into the output string is incorrect.
I have this code (the same that Phoge adwised to use)
and I insert elements from interface one by one and get the result that I already showed0 -
Okay, so that part should work just fine, which means the array isn't getting filled correctly.
Can you post the part where you fill the array?
Does the hardcoded solution you posted at the beginning give you the same result as Phogue's solution?
Also again, I'm still not sure if I understand your problem completely, is it:
a) You get the output of several arrays at once. (do you repeat Phogues code without clearing the variable s?)
b) the elements of the array aren't shown in the order you expected.
c) both
Edit: ah sorry missed the part you wrote about inserting. So I guess the code runs multiple times without clearing the text variable s in between. A simpleCLEAR(s);
before the loop should fix that.0 -
rubberducky wrote: »Okay, so that part should work just fine, which means the array isn't getting filled correctly.
Can you post the part where you fill the array?
Does the hardcoded solution you posted at the beginning give you the same result as Phogue's solution?
The hardcoded solution give me right result.
"ArrayNumber" is the variable of array that have dimension 10 . My code work at the next way:
- entering the first array value
- posted the message with this value before sorting and than message that show the result after sorting
- entering second value
- posted the message before sorting and then message after sorting including first and second values
etc.
Maybe problem of repeating is connected with my way of entering the values of the array?0 -
Hah
I think I know where I have the problem...
Thanks a lot guys for all your answers1 -
rubberducky wrote: »Okay, so that part should work just fine, which means the array isn't getting filled correctly.
Can you post the part where you fill the array?
Does the hardcoded solution you posted at the beginning give you the same result as Phogue's solution?
Also again, I'm still not sure if I understand your problem completely, is it:
a) You get the output of several arrays at once. (do you repeat Phogues code without clearing the variable s?)
b) the elements of the array aren't shown in the order you expected.
c) both
Edit: ah sorry missed the part you wrote about inserting. So I guess the code runs multiple times without clearing the text variable s in between. A simpleCLEAR(s);
before the loop should fix that.
Oh..... Really... I have no explanation how I can missed clear(s)... Thanks a lot)))))))))))) You just have made me happy0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions