question

lancewu avatar image
0 Likes"
lancewu asked Xu Chunqi commented

How to output data in string format

hi guys!

I want to output the content of this data in string format using code.As shown in the following image. What do I need to do?

Thank you for your review



屏幕截图-2023-11-08-094151.png

FlexSim 22.0.16
codedata
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered

Try something like this:

Table.query("SELECT StatisticsCollector.getPathFromID(Object),State,Time, Utilization FROM [State Collector]").cloneTo(Table("temp"))
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

CSN avatar image
0 Likes"
CSN answered Xu Chunqi commented

treenode data = Model.find("Tools/StatisticsCollectors/StatisticsCollector1>stats/data");

string directory = modeldir();

if (!directory.length)

directory = documentsdir();

string fileName = getfilebrowse("*.csv", "Comma Separated Format", "", directory, 1);

exporttable(data, fileName, 1, 0);

· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

lancewu avatar image lancewu commented ·

Hi,thank u.

but I don't want to save this data as a file locally, I just want to convert it into string text

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ lancewu commented ·

'Output' is meaningless unless you qualify the destination - most would assume a text file.

0 Likes 0 ·
Xu Chunqi avatar image Xu Chunqi lancewu commented ·

You can define this node with the type of the table, and then read every row and column in the table in the same way that the table reads, and write it into a text.

To define the table, see Jason's response above, or see the following:

Table data = Model.find("Tools/StatisticsCollectors/StatisticsCollector1>stats/data");


0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.