Fetching Global Variable Value Using String Variable?

Fetching Global Variable Value Using String Variable?

rajankur6494
Collaborator Collaborator
746 Views
25 Replies
Message 1 of 26

Fetching Global Variable Value Using String Variable?

rajankur6494
Collaborator
Collaborator

[ FlexSim 21.0.10 ]


Hi Team,

I am using string variable to get global variable value. But it is writing variable name instead of value. What is the right way to do it?


1654008091820.png

GlobalVariableUsingStringVariable.fsm

Thank you!

0 Likes
Accepted solutions (1)
747 Views
25 Replies
Replies (25)
Message 21 of 26

rajankur6494
Collaborator
Collaborator
I will check and let you know if it works for me.
0 Likes
Message 22 of 26

rajankur6494
Collaborator
Collaborator

Hi @Jason Lightfoot,

I have multiple property belongs to 1 name. For Example: A_Table, A_Chair1, A_Chair2 etc.

How can I extract only "A" out of this (from the object in which labels are defined) to access global table like "A_GlobalTable" and similarly for other objects?

0 Likes
Message 23 of 26

jason_lightfootVL7B4
Autodesk
Autodesk

The letter 'A' must mean something real - floor id , area id or something so you'd put a label on called floor_id or something similar.

Maybe I'm too far away from the problem to see the value of what you're trying to do. I use object pointers not string paths as I find they're more powerful, and try to encourage people to do the same and write simple, generic code that scales. It's not for everyone I guess, but someone is usually paying for time, so it's good not to waste it.

0 Likes
Message 24 of 26

Matthew_Gillespie
Autodesk
Autodesk
@Ankur A3 I agree this looks like a much better approach. I would strongly suggest you use an object-based approach like what Jason is suggesting here. It will save you lots of headaches down the road.


Matthew Gillespie
FlexSim Software Developer

0 Likes
Message 25 of 26

rajankur6494
Collaborator
Collaborator
Hi @Jason Lightfoot,

May be I am asking something very easy but I don't understand what do you mean by floor id here.

Can you help me to understand with example?

Thank you!

0 Likes
Message 26 of 26

jason_lightfootVL7B4
Autodesk
Autodesk
You seem very attached to the name and to you the terms A, Chair and 2 are important form the name. I was mearly implying they must have some purpose which you are not sharing with us. I was just guessing and providing an example that you might be using them to interpret some grouping based on another attribute like 'Floor' or priority or whatever.
0 Likes