Page 1 of 1

Specifying values of Activity Properties using ALH

PostPosted: Tue Jun 29, 2021 3:31 pm
by kfisher@strattechnologies.com
Hello,

I am trying to find a way to add a value to an activity property attribute. I want to use activity properties as opposed to value properties of a block because I intend to reuse this behavior under multiple blocks that have the same data input types.

I would like to loop through some data and construct runtime arrays. I could use opaque actions, but it is time restrictive to initialize each array prior to adding values using javascript or built in math.
ALH.addValue or "add structural feature value actions" would be better for this application. But in order to use ALH helper, or an add structural feature value action, I need the context of the activity in order to add a value to the activity property.

I am able to add the value to the block properties, but not the activity properties. Could someone please help me understand the proper way to do this?
Screen caps and model attached.
Thanks

Screenshot 2021-06-29 173758.png

Screenshot 2021-06-29 173819.png

Screenshot 2021-06-29 173843.png

Re: Specifying values of Activity Properties using ALH

PostPosted: Wed Jun 30, 2021 1:11 am
by saulius_p
Hello,

Good to talk to you. Thank you for your question. Please find small sample. You can run activity with or without context. Works in both cases but with context it can access activity and block properties.

Is this what you are looking for?

Kind regards,
Saulius

Capture.PNG

Re: Specifying values of Activity Properties using ALH

PostPosted: Wed Jun 30, 2021 7:56 am
by kfisher@strattechnologies.com
Saulius, thank you so much for the response!

The activity is running in context, so I have access to both the block and the activity parameters. The issue is that I can't use ALH.addValue to add values to the activity properties.

I am not sure if that is because I am doing the "ALH.getContext" part wrong, or if it is simply not possible to use ALH helper on activity properties? Se the second part of the opaque action below.

Thanks

Screenshot 2021-06-30 082048.png

Re: Specifying values of Activity Properties using ALH

PostPosted: Fri Jul 02, 2021 3:20 am
by saulius_p
Hello,

There is no ALH.getContext("doALHstuff").
We have only ALH.getContext() that will return the running context ("ALH" block).
That is why ALH.setValue() works only for properties of "ALH" block, but not for "doALHstuff" activity.

PS.
- ALH.setValue() will work for properties of the activity, if the running context is the activity itself (run the "doALHstuff" activity directly).
- This is not a good practice to store properties on the activity (or other behaviors), properties should store on class or block.
If you want properties to be shared, you should use the class/block generalization and store shared properties on the general class/block.

Hope this helps.

Sincerely,
Saulius