Skip to main content
Jun 25, 2018 11:48 AM UTC
Question

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

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

Jun 25, 2018 4:47 PM UTC

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.

Jun 26, 2018 7:07 AM UTC

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();
}

rborseAuthor
Jun 26, 2018 7:25 AM UTC

Thanks a lot! It worked for me.