Skip to main content

Yesterday, my shape formulas were working fine.

Today, none of my shapes can see each other.

Example:

  1. All my shapes are identical rectangles.
  2. They have the property “Support” with a value like “#” or “0.6”
  3. They all have the properties “Upstream Test”, “Parent Test”, “Downstream Test” and “Children Test”
  4. Each ‘Test’ property contains a formula like this:  =IFERROR(INDEX(CHILDREN."Support",1),'No Kids')

No matter how I arrange the shapes (eg. within each other, dragging a line from one to the other), they always report ‘No Kids’, ‘No Parent’, ‘None Upstream’ and ‘None Downstream.’

 

Hello SamwiseBrave! I am James Hart, a staff engineer at Lucid.

I have been playing with shapes using the described formulas, and I might be able to answer your question. Creating formulas is difficult and our documentation doesn’t always cover everything that can happen. I think you are running in to some edge cases that make it behave differently from what you expected.

I believe the problem is that “UPSTREAM”, “DOWNSTREAM”, “CHILDREN”, and “PARENT” return an array if there are either zero or more than one elements that are upstream, downstream, etc. If there is a single non-array result, the result will not be an array, which means that trying to index that non-array is an error. To consistently index the result as though it were an array, even if there is only one result, you would have to use a formula of the form

=IFERROR(INDEX(ASARRAY(UPSTREAM."Support"), 1), 'No Upstream')


I think the problem you are having is that the configuration shown above only has a single result for all of these queries, and so the original formula is erroring out on the attempt to even use `INDEX`.


Thanks JamesHart kindly for your reply!

Unfortunately, the solution is partial at best. (I’m still confused as to why it was working last week, but not now, but regardless:)

The UPSTREAM and DOWNSTREAM functions now seem to be working, but not the PARENT and CHILDREN ones:

 


Ok, after some more investigation, I now understand that a shape is not a child simply because it is inside another shape.

Is there a way to add children to a shape that already exists?


For clarity, I want to say that `CHILDREN` and `PARENT` reference a concept in Lucid known as groups.

In Lucid, it is possible to group multiple objects together, which allows you to treat all of the combined things as a single “shape”. This “grouped shape”, or just “group”, can have data, independently of all of the shapes and lines that are in it.  If a shape is part of a group `PARENT` is how you get a reference to that group, and potentially its data, while if you have a group with formulas on it, `CHILDREN` is how you get all of the elements of the group. This has nothing to do with physical location; grouped shapes can have any relationship to each other, and the group automatically spans all of the contained shapes and lines.

Unfortunately, it also has another meaning. if you use `PARENT` on a non-grouped object, it will return a reference to the page that contains it. If you `CHILDREN` on a page, it returns a list of all free shapes on the page. Confusing, I know.

I don’t believe we currently have a formula that represents physical containment like you are trying to get here. I’m sorry, but doing that safely has proven to be a difficult problem to solve.


No worries. That is actually super helpful - Thank you!

Another thing that would be super helpful for the application I’m building  is a separate module (like a hidden cell in a spreadsheet) that does a stack of calculations to enable the formulas in the shape to be significantly simpler by referencing those other modules (as a variable).

To give you some idea of what I’m looking at, this is a relatively simple version of the formula I want to use: (maybe I could do it using a data table shape??)

=ROUND(IFERROR(INDEX(ASARRAY(CHILDREN.'Confidence'),1),1-((1-IFERROR(INDEX(ASARRAY(UPSTREAM.'Confidence'),1)*INDEX(ASARRAY(UPSTREAM.'Support'),1),0))*(1-IFERROR(INDEX(ASARRAY(UPSTREAM.'Confidence'),2)*INDEX(ASARRAY(UPSTREAM.'Support'),2),0))*(1-IFERROR(INDEX(ASARRAY(UPSTREAM.'Confidence'),3)*INDEX(ASARRAY(UPSTREAM.'Support'),3),0))*(1-IFERROR(INDEX(ASARRAY(UPSTREAM.'Confidence'),4)*INDEX(ASARRAY(UPSTREAM.'Support'),4),0))*(1-IFERROR(INDEX(ASARRAY(UPSTREAM.'Confidence'),5)*INDEX(ASARRAY(UPSTREAM.'Support'),5),0)))),2)


SamwiseBrave,

We do have some ways of doing that sort of thing.

You could put formulas to do that on the page, for instance, and reference that using the `PAGE` function. e.g. `PAGE.”Variable 1”.

You could create an invisible block somewhere. You could create a block, set its opacity to zero, give it a user-defined shape id in the right side panel, and then reference it anywhere else in the document by shape id, i.e. as `#”REFERENCE SHAPE”.”Variable 1”.`
 

I have attached a bunch of images to help clarify what I mean by this last example.
 


Reply