Skip to main content
1-Visitor
November 5, 2020
Solved

Setting the default value of Infotable property does not work

  • November 5, 2020
  • 2 replies
  • 5473 views

Hi,

I have a infotable property in a Thing (Generic Thing), and I have set a default value to that Infotable property, but it is not reflected on Composer and even using service. However for other properties I can see the default value reflected as current value.

See attached screenshot.

I am using TWX 9.0.2. I am not sure if the behavior for Infotable properties was always the same.

Does it depend on the DataShape of Infotable?

Thanks in advance

Regards

Aditya Mittal

Best answer by odukiya

Hello @amittal1 

 

As i tried getting more information here i come to know that this is actually working as expected. Let me try to clarify it more here :

 

So If you set something to persistent it will retain whatever value you have. If you mark a property as persisted (with a blank/ null value set), it will persist that value. You then changing the default value or adding a new default value will not matter because the set value is persisted (null in our case). The only reason you see default value getting reflected in non-persisted properties are because of the thing restarting (when you save).

 

I hope it make sense, if this has answered your query here please mark it as the Accepted Solution for the benefit of others with the same question.

 

Thanks 

Om Dukiya

2 replies

16-Pearl
November 5, 2020

Hello @amittal1 

 

I tried but not able to replicate it can you please share your entity once along with datashape you are using?

 

 you can also create a new infotable with different datashape to check if issue is their with the new property too.

 

Thanks

Om Dukiya

amittal11-VisitorAuthor
1-Visitor
November 5, 2020

Hi Om,

Here you can find the attached entity. It is a simply a generic Thing and has one Infotable property with datashape as NumberValueStream.

You can try to import it and then edit it to try to set the default value of the property.

But I think I understood the reason. Follow these steps - 

PROCEDURE 1

Step1: Create a Property and set the default value of the property at the time of creation

Result: Default value is set properly
PROCEDURE 2
Step 1: Create a Thing
Step 2: Add a property (I think any type, not only infotable)
Step 3: Save the Thing
Step 4: Now again edit the Thing and edit earlier added property to set its default value.

Result: Now default value does not apply. I guess it is applicable for all types of properties and not just Infotables

 

I think this is a bug if procedure 1 is working and procedure 2 is not working.

 

Let me know your observation.

 

Regards

Aditya

16-Pearl
November 5, 2020

Hello @amittal1 

 

I tried both the scenarios on twx9.02 and In both the scenarios mentioned by you the problem is due to persistent properties. 

Like if you have any property string or infotable( I tried on both ) and don't mark your properties as persistent it will work fine but in case you mark the property persistent we will get the issue mentioned by you.

For eg create a property (String) mark it as persistent and dont provide default values and save it . After edit if you want to provide the default values you wont be able to do so.

 

I will take it for further investigation to our R&D team . Thank you for reporting it to us.

 

Thanks

Om Dukiya

16-Pearl
January 13, 2021

Hello @amittal1 

 

The issue seems to be working fine in TWX 9.1 . May be you can upgrade to the latest version.

Let me know if you face any further challenges.

 

If your issue has been resolved you can mark it resolved for benefit of others.

 

Thanks

Om Dukiya

amittal11-VisitorAuthor
1-Visitor
January 14, 2021

I tried on Thingworx 9.1 but the issue still seems to be there.

Procedure 2 that I mentioned is still failing

16-Pearl
January 14, 2021

Hello @amittal1 

 

Thank you for the information !!.

 

I am not sure what I am missing here now but i am not able to reproduce it somehow the process i followed is:

 

1) Create a thing with generic thing template 

2) Under properties and alert created two properties one string and another infotable type

3) Save the thing

4) now edit the thing and click on prop1( string ) checked has default value and provided default value ( same changes for infotable property)

5) saved the thing again

 

Result: default values are set in my case and twx version is 9.1.

 

Can you please tell me if i have missed any step here or may be you can share the screenshots of steps you are following so that we can replicate it and resolve it.

 

Thanks

Om Dukiya