I am trying to pull data from a table using a Global Macro. However, I want to label each of my rows with a SKU #. Can I make the Global Macro the SKU #? Or do Global Macros only work with Row #s?
I am trying to pull data from a table using a Global Macro. However, I want to label each of my rows with a SKU #. Can I make the Global Macro the SKU #? Or do Global Macros only work with Row #s?
Hi @Sofia G21, was our answer helpful? If so, please click the "Accept" button at the bottom of an answer. Or if you still have questions, add a comment and we'll continue the conversation.
If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.
Macros just replace their occurrence throughout your code with the text you defined, so if the expression evaluates correctly in a script you can use it as your macro definition.
Table("GlobalTable1")["Row1"]["Col1"]
is a valid expression for a macro that uses the names of rows and columns.
If this isn't what you meant, then please include an example of what you were wanting to try.
Update: re-reading the question it sounds like you want to have in your code:
Table("GlobalTable")[SKU1]["Col1"]
where SKU1 is defined as
#define SKU1 "Row1"
which will work.
Update2:
I think I've finally latched onto what you want which is to have "09343558" as the row name. In the past we tried to avoid having number values for row headers and so I added ":" at the beginning so that they forced evaluation as a string in paths so ":09343558" - which of course can also have a macro definition.
My concern would be that if you have thousands of SKUs do you really want to create macros for them all? It suggests you're semi-hard coding your logic ('semi' since you can change the macro definitions) which might not be the best approach.
Hey Jason, thanks for the various solutions you've provided. Here is what I'm trying to do:
I have a global table. The first column has the number of all of the SKUs (there's only 100). Instead of creating a global macro for the row number (which is difficult to track), I'd rather just call up the row with a Global Macro for its name which is the SKU #. From your notes, I assume this is how you're suggesting I build it? Is this correct?
Sorry I don't like the idea of putting data in the global macros are - usually they're deployed for speed and when you may need to change the format of a table in one place rather than throughout your code (e.g the number of fields and their order). In this case it sounds like it will be more work and not priovide you with the fastest table access.
Can you tell us more about your use case since I now see from your screenshot that ConvertingAsset to SKU is not a one to one relationship. Which value will you know and which value(s). will you want to look up? Will you know single values or a pair of them?
For fast access you can use bundle tables with an index or you can create map of the rows to lookup, but I'd like to give you an example that will work for your case rather than have a number of rounds of suggestions followed by more refined examples of your requirements.
Hey Jason, to reference the screenshot, the Row Name is 1 to 1 to the SKU column. (It doesn't really matter if Converting Asset or SKU is the first column for my use; I could really delete the SKU column if need be). Here's what I'm trying to do:
- I have 25 sources that depending on the SKU they run, they will have a different Inter-Arrival time. Each source can run 3+ SKUs, but only one SKU at a time.
- Every time I run the simulation, I want to say which 25 SKUs will be run. I was hoping of doing this using Global Macros, where I could type which SKU runs on which source ('Converting Asset') and it could pull it from the Global Table. This is where I thought it might be easier to have the Macro use the SKU to recall the row, instead of just recalling the row #.
13 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved