cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Issues with Friendly Names

pshashipreetham
17-Peridot

Issues with Friendly Names

Hi,

 

I have a Data shape with Friendly Names, I have an infotable where I have renamed the columns as per the Fields of the DataShape which has the Friendly Names and is assigned to the result(a infotable which is created based on the DataShape which has the Friendly Names).

When this is done, friendly names are not getting applied on the Runtime.

 

Thanks,

Shashi Preetham,
Email: psp316r@outlook.com,
Mobile: +91 8099838001.
ACCEPTED SOLUTION

Accepted Solutions

Hi, 

 

 I found an exciting learning when I was debugging this issue. When we convert the Infotable to JSON, There will be Sub JSON with DataShape, where you can see the below details of the fields in the JSON:
1. Friendly Name

2. Ordinial

3. Name

4. description

... etc 


So, we can convert the info table to JSON, update this information like the normal field, and convert it back to the Info table. So that in the result, you will see the proper one as you wanted.

The infotable I am getting doesn't have the Friendly Names. Even if I have renamed the Fields based on the Output Infotable Datashape, it will not show up since the JSON has no Friendly Name.

 

Thanks.

Shashi Preetham,
Email: psp316r@outlook.com,
Mobile: +91 8099838001.

View solution in original post

6 REPLIES 6

Thank you for your question.
I encourage you to bring more details and context to your initial inquiry. This will make it easier for you to receive meaningful help from other Community members.
 
Regards,
Andra

hi @achirila ,

 

That's the whole query, can't explain more than that

 

Thanks

Shashi Preetham,
Email: psp316r@outlook.com,
Mobile: +91 8099838001.

Where do you expect to see the friendly names in runtime would be one question. E.g. as Grid Headers? Or where?

I actually do not know what the feature behind "friendly names" exactly is.

 

I only found out that it seems to use the friendly name in composer-result view:

DataShape with a property "FieldName" and a friendlyname set:

nmutter_1-1699968625413.png

Service output result shows "Friendlyname" as header:

nmutter_0-1699968611992.png

Mashup only shows "FieldName"

nmutter_2-1699968708936.png

 

Not sure of the intended use of "FriendlyName"-feature.

Edit: In the docs I only found that this widget makes use of friendlynames in runtime: https://support.ptc.com/help/thingworx/platform/r9/en/?#page/ThingWorx/Help/Mashup_Builder/Widgets/PropertyDisplayWidgetThemable.html (if you search for "friendly name" on the page you find "If the field has a friendly name defined in the Data Shape definition, this name is used.")

Hi @nmutter ,

- I am not pretty sure of the friendly name feature, too. I have been using it for a couple of months now.
- Usually, the Team uses it to show the headers on a custom-made widget on runtime, similar to Grid.

- If you have friendly names set, then when you run the service in the composer also, you will see it as headers of the infotable that confuses in some use cases

Issue is:
When I assign the Infotable of Var to another Infotable(a data shape with Friendly Names) of the same fields, these friendly names are not rendered on the Screen.

Shashi Preetham,
Email: psp316r@outlook.com,
Mobile: +91 8099838001.

I think now I know what you try to do:

  1. You have a DataShape A with property e.g. 'name'. This DataShape has no friendly names set.
  2. You have created a second DataShape B with same properties e.g. 'name', but additional friendlyname set
  3. Now you created a service like

 

let dataShapeAInfotableWithData = // get the data from somewhere

// service return result is set to be of type DataShape B
result = dataShapeAInfotableWithData;

 

  • And when executing the service, in the end the result does not have the expected friendly names of DataShape B.

If that is your issue I can explain it: Defining a result datatype is not converting the result of the service into the specified return type. This is just for "developer" interest/documentation basically. The result should be of that type.  If the service returns a different type, this type is returned. In your case you still return DataShapeA, not B.

 

To fix your issue you would have to create a new Infotable of the correct DataShapeB and add all rows of the other infotable. E.g.

 

let dataShapeAInfotable = undefined; // get data from somewhere

// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(AcceptableMissedPings)
let result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({
    infoTableName: "InfoTable",
    dataShapeName: "DataShapeB"
});

dataShapeAInfotable.rows.toArray().forEach(row => {
    result.AddRow(row);
});

 

 

 Hope that helps!

Hi, 

 

 I found an exciting learning when I was debugging this issue. When we convert the Infotable to JSON, There will be Sub JSON with DataShape, where you can see the below details of the fields in the JSON:
1. Friendly Name

2. Ordinial

3. Name

4. description

... etc 


So, we can convert the info table to JSON, update this information like the normal field, and convert it back to the Info table. So that in the result, you will see the proper one as you wanted.

The infotable I am getting doesn't have the Friendly Names. Even if I have renamed the Fields based on the Output Infotable Datashape, it will not show up since the JSON has no Friendly Name.

 

Thanks.

Shashi Preetham,
Email: psp316r@outlook.com,
Mobile: +91 8099838001.
Announcements


Top Tags