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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Hide Mashup Content when thing does not implement shape

Christian_S
6-Contributor

Hide Mashup Content when thing does not implement shape

I am having a mashup with a List of different Things (Shape.ImplementingThings) and a Tab-Widget. 

Now I want to hide Tab1 when the selected Thing is not implementing a specific Shape.

I tried to put a Value from a dynamic GetProperty datasource to a validator widget and put the output to visibility of the tab. I checked the "name" property against null and undefined, but it was always true.

 

Is there any possibility to get a boolean for a dynamic thing if it does not implement a specific shape?

 

Best regards.

5 REPLIES 5
PaiChung
22-Sapphire I
(To:Christian_S)

What statements are you using for checking null or undefined?

 

You could use a wrapper service to add that boolean to the information provided to the mashup up front.

ie let's say you are using GetImplementingThings, you can create a service with that as a basis and then add a column of information (use DeriveFields) to add that boolean.

Christian_S
6-Contributor
(To:PaiChung)

My current approach was like this:

 

 

visibility.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

So when I select a thing which implements the thingshape "Searchable.TS" the evaluation of an expression/validation gets triggered, which gehts the "name" property of a "Addressdata.TS" Shape - GetPropertyValues function.

 

So when I select a thing, the dynamic GetPropertyValues should get called. When the selected thing hasn't implemented the address shape the result should be null, correct? So when I than put an property of the non existing result to an expression, i should compare to null or undefined to set visibility.

 

if(data && data !== null && data != 'undefined');

But this returns true always.

 

 

posipova
20-Turquoise
(To:Christian_S)

You may try using this service, defining your exclusion in a json format:

 

// result: INFOTABLE dataShape: "EntityDescriptor"
var result = Resources["SearchFunctions"].SearchModelEntitiesWithRestrictions({
maxItems: undefined /* NUMBER */,
searchExpression: undefined /* STRING */,
types: undefined /* JSON */,
aspects: undefined /* JSON */,
excludedAspects: undefined /* JSON */,
maxSearchItems: undefined /* NUMBER */,
tags: undefined /* TAGS */
});

Christian_S
6-Contributor
(To:posipova)

Hay @posipova,

 

where should I add this service as best option? Is there any kind of resource or something? Or should I hava a "Utils-Thing" with supporting global services for usage in mashup?

 

And can you give me a short example where to add the "shape" name in this example?

posipova
20-Turquoise
(To:Christian_S)

This would be a custom service you would need to write on any Thing of your choice, whatever most applies to your application design. You'd be writing a search expression in JSON format in this line:

searchExpression: undefined /* STRING */,

 

For more details, please open a Tech Support ticket at support.ptc.com

 

Thank you!

Top Tags