The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
"Passing calculated macro values into report"
Hi,
maybe I am missing something but I can't figure this one out....
Lets say you have a process with some defined macros. In a report you link them through realm variables and you can display these values in text field by referencing them as %{variable_name} .
Problem is you see these values at the beginning of the process, not the end, so if any of these values get recalculated, you don't see these results.
Simple problem, I want to display the time report was executed. In the process I generate macro "now" which runs function date_now().
In the report I always get empty space which is what macro "now" is at the beginning of the process execution...
Is there anything that can be done to reference macro values at the end of the process execution?
Thanks
Ozzy
maybe I am missing something but I can't figure this one out....
Lets say you have a process with some defined macros. In a report you link them through realm variables and you can display these values in text field by referencing them as %{variable_name} .
Problem is you see these values at the beginning of the process, not the end, so if any of these values get recalculated, you don't see these results.
Simple problem, I want to display the time report was executed. In the process I generate macro "now" which runs function date_now().
In the report I always get empty space which is what macro "now" is at the beginning of the process execution...
Is there anything that can be done to reference macro values at the end of the process execution?
Thanks
Ozzy
0
Answers
yes. Since RapidMiner Server 2.4, you can set an option in the general settings of each app. When you active the "Allow processes to set app variables via context macros" option, the value of a predefined process macro will be written back to the app variable at the end of the process. That way, you can read in a variable from the app, change its value in the process and have the change reflected back to the app after the process has finished.
Regards,
Marco
The process (and associated service) creates a table. I use Extract macro type "number_of_examples" to define a macro called example_count. Now I have number of rows which I would like to display in the report.
In service definition I delete parameter binding section for example_count. (since we are not passing this macro back to service)
I go to Manage Domain and in my realm I define number domain called example_count with all default settings (0.0 is default value).
In the app (report) I create variable "example_count" and point it at domain "example_count".
I create visualization component pointed at globally defined service from above.
I create text component with text: "Counter: %{example_count}"
Preview shows text "Counter: 0.0" , followed by the table in visualization section but "Counter: 0.0" does not change after the process is completed. The macro value is not being written back to the variable.
I checked, and if I run process in studio the "example_count" macro gets changed to a number of rows, so macro is getting set.
In app general settings the "Allow processes to set app variables via context macros" is set.
Am I doing something wrong here?
Thanks,
Ozzy
you are correct, it won't work with global services for technical reasons. You either have to use the app initialization process or add a "Run process" effect for the process in question to any of your components.
Regards,
Marco
sorry I am not following you..
First option - do you mean I have to run app initialization process to calculate the macro which then gets defined and read by the report at the beginning of the process...?
Second option - "add a "Run process" effect for the process in question to any of your components". I am afraid I don't understand this one at all... could you please give me some more detail? What is "Run process" effect and where am I adding it to?
Thanks
Ozzy
when your initialization process defines macros in its context, the values of them are written back to the app at the end of the process - if there is a variable with the same name.
Apart from that you can also write macro values back whenever the user interacts with your app.
Note that when your data source type is a globally defined service (1 in the picture), macro values at the end of the process behind that service are NOT transferred back to the app due to technical reasons. Same for when you use a process as a data source for your visualization component (2 in the picture).
To write macro values back, you need to add Interaction effects (3 in the picture). You can then chose from various effects, e.g. a "Run process" effect. Processes which are executed via that can write their macros back. These interactions occur when the user clicks on a component which supports these effects, e.g. buttons or charts.
Regards,
Marco
I now set "process as a data source" and managed to get macro values to transfer only if I Use Run Process effect .
Problem is that first time I run the process nothing gets updated, so I have either empty space or worse, the variable value from the previous run.....
I was also unable to get initialization process to set these values either. The funny thing is if I "run the initialization process now" in the setup screen, the macro values get pulled through, so I see these values at the next run but they do not update any more when I run the app.
So this kind of looks like a bug to me...
Your thoughts?
Kind regards
Ozzy
sorry for that, I was mistaken about 2). I have adapted my previous answer. The writing back of values only works for Initialization processes and "Run process" effects.
I cannot reproduce your problem regarding the initialization processes though. The process is executed when someone opens the app for the first time. If he then views a different app without explicitly closing the first one, the init process will not run again as the state is preserved unless the user closes the app.
Regards,
Marco
Unlike Macros, publishing to an app creates a piece of data unique to the server login. A macro creates a piece of data unique to the process run, so when you could have two different variables setting the same macro with no conflict. In your example you want to set the data in one place for all other processes to read it.
Here's a really simple example.
Step 1: Set the counter. Step 2: Read the counter. There's more things you can do with this, for example you could set your entire counter HTML and store it as the Publish to app with the Retried