Solved

Comma in Text impacts the CONTAINED function in custom field

  • 18 March 2024
  • 3 replies
  • 51 views

Badge +1

I’m using the REST API to export document contents to JSON.

https://developer.lucid.co/rest-api/v1/#get-document-contents

In my use case, I want to find the stick notes that belong to the container. For that purpose I’m using a custom field and the CONTAINED function.
The JSON looks as follows:
 

{
"id": "vaXcl.RlvRIQ",
"class": "SparkContainerBlock",
"textAreas": [
{
"label": "Text",
"text": "People"
}
],
"customData": [
{
"key": "Contained",
"value": "[Not trained enough, Working overtime]"
}
],
"linkedData": []
}


If we change the sticky note text "Working overtime" to "Working overtime, exhausted and frustrated" then the JSON will look as follows.
 

{
"id": "vaXcl.RlvRIQ",
"class": "SparkContainerBlock",
"textAreas": [
{
"label": "Text",
"text": "People"
}
],
"customData": [
{
"key": "Contained",
"value": "[Not trained enough, Working overtime, exhausted and frustrated]"
}
],
"linkedData": []
}

As you can see the comma in the text will be recognized as a value separator.

icon

Best answer by alyssa 22 March 2024, 19:11

View original

Comments

Userlevel 1
Badge

Hi Marcin! Thanks for raising this issue.

 

To make sure I am understanding the problem correctly. You have a shape in which you have attached some custom data to. That custom data’s value is a formula for an array something like this:

=ARRAY(“Value1”, “Value2, Continuation”) 

The problem then arises when document contents returns that custom datum as “[Value1, Value2, Continuation]” which when parsed appears as if it is 3 distinct array entries even though from the formula in the UI it is actually only 2. Is that a correct summary of what is going on? 

 

A few extra questions if you don’t mind, what are you trying to do and why and how much of a blocker is this issue to you?

 

Thanks again for raising this issue and we will continue to investigate.

Badge +1

I’m exporting my document to JSON using REST API and I need to find sticky notes that belong to the- “People” container.

Badge

Hello Marcin!

We have shared this feedback with our teams and appreciate you sharing this out.

In the meantime I wanted to offer a few options as workarounds:

  1. You could modify your formula to be =JOIN(CONTAINED, delimiter) where delimiter is some string you are confident won’t be typed out on the shapes.
    In your example if we used “$$$” as the delimiter this should show up as ”value”: "Not trained enough$$$Working overtime, exhausted and frustrated"
    Then you can split by the delimiter as you’re parsing the exported JSON
  2. Alternatively, you could do a formula like =CONTAINED.$id to get all of the shape ID’s that are in the container, and then map that to the shapes in the JSON based on that ID. If you’re wanting text on the shape specifically then I’d recommend the first option.

Reply