ATTENTION

This 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

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 03-02-2011
Nischith Kashyap's Avatar
Nischith Kashyap Nischith Kashyap is offline
Flexsim User
 
Join Date: Nov 2010
Location: Wollongong, Australia
Posts: 51
Downloads: 26
Uploads: 0
Thanks: 19
Thanked 0 Times in 0 Posts
Rep Power: 118
Nischith Kashyap is on a distinguished road
Default 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  
Old 03-03-2011
Esther Bennett Esther Bennett is offline
Flexsim User
 
Join Date: Mar 2008
Posts: 115
Downloads: 27
Uploads: 0
Thanks: 103
Thanked 116 Times in 50 Posts
Rep Power: 271
Esther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to all
Default

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  
Old 03-03-2011
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

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  
Old 03-03-2011
Jörg Vogel's Avatar
Jörg Vogel Jörg Vogel is offline
Flexsim User
 
Join Date: Sep 2007
Location: Hannover, Germany
Posts: 643
Downloads: 35
Uploads: 0
Thanks: 802
Thanked 665 Times in 410 Posts
Rep Power: 642
Jörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond repute
Default

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  
Old 03-03-2011
Brandon Peterson's Avatar
Brandon Peterson Brandon Peterson is offline
The Flexsim Consultant
 
Join Date: Jul 2007
Location: Salt Lake City, Utah
Posts: 382
Downloads: 29
Uploads: 6
Thanks: 192
Thanked 516 Times in 235 Posts
Rep Power: 490
Brandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant future
Default

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


All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.