Notifications
Announcements
No record found.
Hi,
I need to read the Site and Warehouse values from an excel sheet. But it returns an empty value. For example if my site is "1" it returns empty. Here is the code. Help me on this.
site = cells.item(row, 4).value().bStr(); warehouse = cells.item(row, 5).value().bStr();
Regards,
Ram
Hi Ram,
Please check if the cells are storing the values as integers instead of string. That might be causing the values to be returned as empty.
Hi Gunjan,
As it is a integer value "1" it cant read ,it only reads a string value. what steps i have to do to read a number value.
In AX, site and warehouse ids are strings. Therefore I suggest to handle them as strings in Excel, too. Otherwise you can't use the Excel or your code if your customer has (now or in the future) a site or warehouse where the id has other characters than numbers.
You can try one of two options -
1. Change the value in excel cells to be of type string, rather than integer. This is a better option you can set the excel template in the same way.
2. You can try to convert the integer value to string and check if that works-
site = int2Str(cells.item(row, 4).value().int()); warehouse = int2Str(cells.item(row, 5).value().int());
I have already tried converting integer value to string but this also returns empty value.
It's better you change the format of the cell to Text. If any string values are passed later like "1A", "2B" etc, your code will fail.
Hi Ram Kumar,
Check if you see "ComExcelDocument_RU" class in AOT. It has a method "variant2Str" which automatically converts a value from Excel type to string.
site = ComExcelDocument_RU::variant2Str(cells.item(row, 4).value()); warehouse = ComExcelDocument_RU::variant2Str(cells.item(row, 5).value());
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.
André Arnaud de Cal... 449 Super User 2025 Season 2
Martin Dráb 422 Most Valuable Professional
BillurSamdancioglu 239 Most Valuable Professional