VB API export a table to csv format - Data type?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
VB API export a table to csv format - Data type?
Hi, I’m new to my company, and we use Creo 9.0. Previously, I worked with SolidWorks and developed some useful VB tools there. Now, I’d like to replicate that for Creo.
One task I’m trying to accomplish is verifying whether all parts have the correct parameters. I’ve created a VB.NET code to:
- Generate a drawing template and use the repeat region to collect all the parameters in parts within an assembly.
- Export the table to a CSV file so I can analyze it in Excel.
However, I’m encountering an issue when exporting the table to CSV. The problem is that not all models have the same parameters. When I use the repeat region to generate the table, some cells are empty. Whenever my VB program encounters these empty cells, it stops running.
I believe the issue is related to data types. The VB API seems to handle only text formats (stringseq), but when it encounters an empty cell or a cell containing a real number, the program throws an error.
Does anyone have a solution for handling different data types in this situation?
Thanks for your kindly help.
Solved! Go to Solution.
- Labels:
-
ProToolkit
-
Toolkit
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Ok, I found the solution. When there was no such parameter in the components. The data type in the blank cell is not stringseq as some forum suggested. But I can use relation to convert them into text
Here is an example of what I did.
if exists ("asm_mbr_size")
SIZE_TEXT =asm_mbr_size
else
SIZE_TEXT ="-"
endif
then I replace "&asm_mbr_size" in the repeat region by "&rpt.rel.SIZE_TEXT". That will force the blank cell to be "-". which is a string and can be extracted by GetText
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Ok, I found the solution. When there was no such parameter in the components. The data type in the blank cell is not stringseq as some forum suggested. But I can use relation to convert them into text
Here is an example of what I did.
if exists ("asm_mbr_size")
SIZE_TEXT =asm_mbr_size
else
SIZE_TEXT ="-"
endif
then I replace "&asm_mbr_size" in the repeat region by "&rpt.rel.SIZE_TEXT". That will force the blank cell to be "-". which is a string and can be extracted by GetText
