Cross-doc images - formula

Hi ! I’m trying to cross-doc images by using a formula @Breno_Nunes kindly shared, but it’s not really working in my case…

I have a table in Doc A with a file column that can have 0 to 4 attachments.
I’m using cross-doc to add a row in a table in Doc B with these documents each in its own column (columns 1, 2, 3 and 4).
In the formula, when referencing the columns in Doc A/B, I currently have:

(…)
“column 1 Doc B”, _Deref_Object(_Merge(thisRow.[column Doc A].Nth(1)), “publicUrl”),
“column 2 Doc B”, _Deref_Object(_Merge(thisRow.[column Doc A].Nth(2)), “publicUrl”), "
column 3 Doc B", _Deref_Object(_Merge(thisRow.[column Doc A].Nth(3)), “publicUrl”),
“column 4 Doc B”, _Deref_Object(_Merge(thisRow.[column Doc A].Nth(4)), “publicUrl”)))

Everything works if I have 4 documents in Doc A, but if there are no docs I get the message:
“Nth expects parameter list to be a list of anything, but found value (‘’), which is a text value”

If I have less than 4 docs I get the message:
“Parameter to NTH must be between 1 and the length of the list”

How can I correct the formula so that it works?

Thanks!!

Hi, @Filipa_Didier.
You can add an “if clause” that shows blanck whenever the file doesn’t exist. Check the formula bellow if it works for you.

If(thisRow.[column Doc A].Count()<2, "",_Deref_Object(_Merge(thisRow.[column Doc A].Nth(2)), "publicUrl") )

It’s perfect, thank you!!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.