Concatenating two objects to create; Returning ObjectId instead of Name

Hi All,

My use case is that I’m trying establish relations for a new record in a table based off of information from two other tables.

As an example I have a Brand table (IE Hubble) and a company table (IE IDS) and I’m looking to create a new record in a Contract table that holds the contract information between them. One of the properties in the new record is a short form name. I had hoped for it to be a concatenate of the two names (IE IDS_Hubble).

To do this, I have been setting both the brand name and the Company name in page data and have then used a “Create Text with” block to create Joe_McDonalds. However, one name (Customer Name) is returning either the ObjectId or [object object] instead of “the name” in the concatenate.

I have attempted to redefine page data as part of the logic block, but seem to end up in roughly the same spot. Is there something that I’m missing as far as data type I should be aware of?

I’m also having challenges with actually setting the relations- the error that I’m receiving is that the children should be passed over as a string. I’ve attempted to use the “convert object to string” block without any difference. Would appreciate any suggestions.

Hi Aaron,

What output does the highlighted “print” block produce?:

Regards,
Mark

Here is the output and the error message

Looks like the “FCName” property in “PageData” contains an object. What you need to do is change “FCName” to “FCName.objectId” in here:

Thanks Mark,

That didn’t seem to solve the issue, but I’d like to understand your reasoning a bit more- My understanding is that FCName.objectId would have suggested that there was a table named FCName and we wanted to return the objectId property. Is that what was intended? My understanding of page data was that it acted as almost a hidden temporary table with properties that I defined throughout the page. Is that correct?

When i replaced FCName with FCName.objectId is the field you suggested I get the following error.

When I replaced it in both the variable block and the object relations block I got the following error.

image.png

Hi Aaron,

It has nothing to do with tables. PageData is a key/value type of storage. FCName is a key and the corresponding value is an object. That object in turn is also a key/value storage.

What you ultimately want (for the Save Object in Backendless block) is to get objectId property from the object that is mapped to FCName. A shortcut for this (again ONLY for the “Sace Data in Backendless” block) is to reference it like this:

FCName.objectId

Now, the error you are seeing is actually from the “Set Object Relations” block.

I recommend you watching the following video to become familiar with that operation:

Regards,
Mark