Page 1 of 1
Retrieve custom properties with variable
Posted: Fri Jan 10, 2020 1:01 am
by geo
Hello
I'm trying to retreive a value from the custom properties of a button
Code: Select all
put the cZNR["Mass"] of button "btnRegistration" into tMass
this works fine
Now I need to store more data in the custom properties and would like to call it like:
Code: Select all
put the pItemname["Mass"] of button "btnRegistration" into tMass
where cZNR is in the variable pItemname.
That doesn't work
Thanks for your help
Re: Retrieve custom properties with variable
Posted: Fri Jan 10, 2020 2:16 am
by dunbarx
Hi.
Not sure what you want.
Is pItemName, typically a parameter when selecting a menuItem from a menu style button, what you are talking about? If so, is “mass” the selected menu item?
I would not use that particular name that way, assuming you are referencing a custom property that way.
Anyway, why try to store a custom property inside another custom property?
Craig
Re: Retrieve custom properties with variable
Posted: Fri Jan 10, 2020 5:12 am
by dunbarx
Hmmm. Is it that you just want to extract a particular custom property by selecting the property name from a menu?
I am away from my computer for a while so someone else will have to see if LC can resolve that parameter as you want But if it can’t, then I will bet a “do” construction will probably, er, do it.
Craig
Re: Retrieve custom properties with variable
Posted: Fri Jan 10, 2020 7:01 am
by FourthWorld
There are a couple different ways to go, but help me catch up with what you're envisioning: what is the benefit of binding the data to a specific object?
Re: Retrieve custom properties with variable
Posted: Fri Jan 10, 2020 7:42 am
by geo
Hello,
I have about 20 fields where the user can change the value. Each field has a custom property stored which is use for a calculation:
Fieldvalue * constant
For this one field the user has to select a value per dropdownmenu from a different button which is then inserted in the field plus the constant has to get changed according to the user input.
With a repeat function I can loop through the fields for all calculations
Re: Retrieve custom properties with variable
Posted: Fri Jan 10, 2020 12:00 pm
by mrcoollion
geo wrote: ↑Fri Jan 10, 2020 1:01 am
I need to store more data in the custom properties
Place data in variable tData into a custom property CustompropertyName
Code: Select all
set the CustompropertyName of button "btnRegistration" to tData
Re: Retrieve custom properties with variable
Posted: Fri Jan 10, 2020 12:07 pm
by Klaus
Hi Geom
you are dealing with custom property sets, right? At least the syntax looks like.
Then you could do it in two steps:
Code: Select all
on menupick pItemName
set the custompropertyset of btn "btnRegistration" to pItemName
put the Mass of btn "btnRegistration" into tMass
end menupick
Tested and works!
Best
Klaus
Re: Retrieve custom properties with variable
Posted: Fri Jan 10, 2020 9:50 pm
by geo
Hi Klaus
Thanks, works perfect
Any Idea why it doesn't work when I have the name of the custom property set in the variable like i described in my post?
Re: Retrieve custom properties with variable
Posted: Fri Jan 10, 2020 10:15 pm
by Klaus
Sorry, no idea...