Notifications
Announcements
No record found.
Hi All,
I have a string returned by API which I need to parse to csv or any other format supported by List Box (or List View) and display on Form.
How to parse string to csv in X++?
However, I didn't find much info about List Box or List View so would appreciate your help in choosing right control and examples how to pass data to it.
Thank you!
You don't need a CSV when setting up a ListBox or ListView, so there's no need to parse text into CSV.
Did you mean that the API returns a CSV and you want to populate a ListBox/ListView with the values from the CSV?
If yes, you could cast the CSV into a container with str2con function, and then iterate the container to add elements to ListBox or ListView.
If no, then you need to let us know the format of the information that you get from the API.
I found a lot of examples of ListView and ListBox by web search, here's one: axbeginners.blogspot.com/.../listviewcontrol-in-dynamics-ax.html
You can't parse text to CSV. CSV is a text format, therefore you can either parse CSV text to something you can work with, or you can take data and serialize it to CSV.
Also, you can't simply pass CSV to those form controls, therefore your design wouldn't work.
Before we can tell you how you can parse the string returned by the API, you'll have to tell which format it's using.
A better option than using List Box or List View controls may be putting the data to a temporary table and displaying it in a grid.
I have str variable which looks like usual CSV seperetad by comma
"Header1", "Header2", "Header3"
"Value1", "Value2", "Value3"
... ... ...
So, you have a CSV.
Then you can follow the approach that I suggested in my earlier message (as mentioned in that message).
Thank you for help!
I saw the article you sent but didn't find how to add multiple columns and data to them
If you need multiple columns, the right type of control is grid. As I mentioned, you can insert records with the data into a temporary table and use this temporary table as the data source of a grid.
So, List View doesn't support multiple columns, right?
It does - you can use addColumn() method.
But there is a reason why grids, rather then list views, are normally used for showing tabular data. For example, they allow users to easily sort and filter data.
I have a requirement to use list.
When we do addColumn() method how then we insert data to different columns?
A requirement? Why? What's the business requirement leading to this technical requirement? What if I confirmed your statement that it can't be done? Would it still be a requirement? Would you tell the client that showing the data is impossible, or would you accept that the type of control is an implementation detail and you can implement the business requirement in different ways?
Anyway, this is an example how you can create multiple columns in a list view and set some values:
listView.addColumn(1, new FormListColumn("First")); listView.addColumn(2, new FormListColumn("Second")); FormListItem item = new FormListItem(); int idx = listView.addItem(item); listView.setText(idx, "Value A", 0); listView.setText(idx, "Value B", 1);
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 660 Most Valuable Professional
André Arnaud de Cal... 549 Super User 2025 Season 2
Sohaib Cheema 307 User Group Leader