Skip to main content
5-Regular Member
June 25, 2018
Question

How can I fetch token from specific Localization Table programatically through extension SDK in twx?

  • June 25, 2018
  • 3 replies
  • 2172 views

I am trying to fetch token from specific Localization Table (i.e. only from the Localization Table named as  "es") through the extension SDK in thingworx.

I am using "com.thingworx.localization.LocalizationTable.GetToken" api. But it always returns the token value from the "Default" Localization Table. I also tried  "com.thingworx.localization.LocalizationTable.setName" api to set the name of the expected Localization Table but it didn't worked.

Can I get any code reference in java?

3 replies

22-Sapphire I
June 25, 2018

You can call against the table directly.

So within Thingworx it would be LocalizationTables["es"].GetToken{params}

sorry not sure how that would translate into the SDK

I don't think there is a service that allows you to do that by doing a call that specifies the actual localization table you want it from.

13-Aquamarine
June 26, 2018

The Java code should look like this:

LocalizationTable esLocalizationTable = (LocalizationTable)EntityUtilities.findEntity("es", RelationshipTypes.ThingworxRelationshipTypes.LocalizationTable);
try {
  String valueToken = esLocalizationTable.GetToken("yourtoken");
} catch (Exception e1) {
   e1.printStackTrace();
}

rborse5-Regular MemberAuthor
5-Regular Member
June 26, 2018

Thanks a lot! It worked for me.