ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
#1
|
||||
|
||||
How to change Table format from int to str
Hello
We are creating tables in the tree structure, and the default type in a table is an int. We would like to make all the values in the table str and not int using code. We tried right click, and we could change each cell format, but since we have 86400 rows in our table, is it possible to change it via code. Thanks |
#2
|
|||
|
|||
Hello Nischith,
It is possible to change the values into strings but why would you want to do that. Reading your other posts, you already have a large model with a lot of data, and reading strings from a table is slower than reading numbers. Maybe you could tell us what you want to do with the table and why you think you need strings. Maybe there is a better solution. Esther |
#3
|
|||
|
|||
This post also applies to formatting a single table and should help answer your question.
If you're thinking about the datetime format coming in as a string (as from my example in your other post) then: 1) don't worry about that - bring it in as a double but subtract the start date in the query - which will give you the number of days from the start of your model rather than the number from 1st Jan 1900. You can even multiply by your own time units per day to make it compatible with your model (usually 86400) 2) reply to the original thread so that we can see some context to what you're trying to do. I do agree with Esther, Hemmi and others that have been commenting on your approach as indicated by your posts - who have a number of concerns about what you're doing not being well conceived or efficient. It might be worth contacting someone to see if you can get a full review of your model. By the way the default datatype is double, not integer. |
The Following User Says Thank You to Jason Lightfoot For This Useful Post: | ||
Scott Mackay (03-08-2011) |
#4
|
||||
|
||||
Hi Nischith,
nodeadddata(...) may help you. The reference of the node can be gettablecell(...). The example model changes the value in the table on reset and creation (run). Jörg Last edited by Jörg Vogel; 12-03-2014 at 03:25 AM. |
The Following User Says Thank You to Jörg Vogel For This Useful Post: | ||
Scott Mackay (03-08-2011) |
#5
|
||||
|
||||
Nischith,
If you are only doing this once for each table then the easiest way is to right click on the table node and explore it as a table. Then select a whole column/row, right click and assign the data type that you want. You can hold down shift to select more than one column/row at a time. If that takes too long then Jorg's suggestion of using nodeadddata() with some for loops would be the best way in code. If you are using the MTEI to import the tables then you can just tell it to import them as number or string data to begin with. If you don't want the whole table to be the same and you are trying to import numbers as text, then you will want to use the row/column data distinction option. Good Luck, Brandon
__________________
thats not normal. |
The Following 2 Users Say Thank You to Brandon Peterson For This Useful Post: | ||
Scott Mackay (03-08-2011) |
Thread | Thread Starter | Forum | Replies | Last Post |
CAD's STEP format | Kenny Macleod | Q&A | 4 | 03-09-2011 04:23 PM |
Change name of the GUI | Congshi Wang | Q&A | 1 | 11-08-2010 05:39 AM |
Change Layout from GUI | Nico Zahn | Q&A | 4 | 12-24-2009 07:42 AM |
How to change color when full? | Jamie Santa Ana | Q&A | 2 | 09-23-2009 06:00 PM |
Can I make a column of a global table to type table? | qin tian | Q&A | 0 | 10-01-2008 09:27 PM |