Access nth COPY (read only) attribute values in/with Dynamic Component?

dynamic
copy
nthcopy
attribute
copyattribute

#1

I think I know the answer, but is there any way to access an attribute value for the nth copy in a repeating child component? As it is, the child values are for the “COPY 0.0” copy.

Here is my situation: I have a grid array. Scaling increases and decreases the copies Assume I make an array 3x3, below shows the COPY attribute value.

6 7 8
3 4 5
0 1 2

Interacting with each copy will hide it, via some OnClick magic. If I interact with copies 1,2 and 7, the HIDDEN attribute values are now:

0 1 0
0 0 0
0 1 1

If in the parent I create a custom attribute with the formula =child!hidden, it will return the value for copy zero, or “0” What if I want to report up to the parent other copy hidden values?

OR

What if I want to count how many copies are hidden and put that into a parent attribute? Even if I could concatenate a new attribute value like “011000010”, representing the nth values from copy 0 to copy 8, that would be something I could work with.

I am going to guess the answer is yes with Ruby, no with built-in DC functionality.


#2

I’m not sure I completely follow.
You have example 9 copies (original plus 8 copies) and you want to know how many are hidden (shown in parent component)

My only guess is a ton of IF statements, to check how many copies you have and then check each one. Find out how many copies, then IF Copies1!hidden =0, then +1 to a counter, etc.
Since hidden is a 1/0 value, something like =Copies1!hidden+Copies2!hidden+Copies3!hidden+Copies4!hidden to the nth value. There’s probably a math function that can do that in DC no?
Though I feel like there should be an easier way with built-in dc functionality, just not coming to me at the moment.


#3

That is one problem there. I do not think there is a way to access the attributes for anything other than COPY 0 (the original). I can calculate the total number of copies easily. I did try to make the copies have dynamic names but the child in child!attribute is the name of the object, not any attribute.

IF there is/was a way to call up specific copy attributes, I could do a parent

=concatenate(child!hidden+"_"+child#1!hidden+"_"+child#2!hidden...

to return a value like

0_1_0_0_0_0_0_1_0

I am 95% sure that there is no way to do anything like that. Unless there is some undocumented feature. Also just assume in my example my child object is named “child”. I know child!whatever doesn’t work the same as parent!whatever.

– Matt


#4

Oh I see…hmm, seems kinda odd that we can pass info down to copies but not back up…I’ll play around. I don’t know Ruby unfortunately…


#5

Ooh ooh! I have this deeply burning need also. My situation is:

  • Making a window DC with multiple sashes and optional mullions in-between,
  • Made it for a max of 6 sashes as that seems a sensible number of nested IF conditions,
  • It’d be better if the max number was unfixed but this requires a way to pass values back and forth from parent! to child!copy,
  • I tried concatenating strings to use as child!copy reference addresses but couldn’t get it to work,
  • I’m a noob at DC coding and so am unsure if I did the concatenation attempt justice,

And yes, I will not be surprised if the answer is, “Yes in Ruby” : )


#6

If you wish to access the individual copies, you need to set a maximum number of instances, like an array from 1 to 25, you can not use n cases, although the nth case is copies +1, one has only a limited amount of individual input attributes.
So for upto 25 cases, to alter each LenX, you will need 25 attributes to hold the values! If you do decide on this approach I recommend you use Choose(copy+1,value1,value2,…) rather than nested if statements
You can write to each copy but you can not get the parent or original to read them, so determining whether a copy is visible is not possible