Skip to main content

Machine efficient data sources often identify objects via numbers.  Human friendly representations of same data uses names instead. When exchanging data with both machine efficient data sources and human friendly data sources translations are common.

The attributes binds-to-display-name and range-display-name, introduced with AimmsDEX 24.6, facilitate translations between element representations, for instance a translation from number to name and visa versa.

 

Interface


The running example uses locations and connections, and its interface looks as follows:

The locations are actually numbers, and the annotation webui::ElementTextIdentifiers translates these numbers to names in the UI.

 

Input


The input is in SQLite tables, such as:
 

The input identifies each location by its number, and has a name as attribute
​​​​​​

 

Writing Excel directly:

 

With this data, it can be directly written to an Excel sheet.

The mapping file this table looks as follows:

 

And the corresponding data sheet that comes out of it looks as follows.
 

Locations are numbers here.

As you can see, the locations are still identified by their number.

 

Writing with name translation:

 

To use the names of the locations as the identification, a translation from number to name is needed.  This is facilitated by the binds-to-display-name attribute.

 

Here binds-to-display-name is added.

 

Which will result in the data sheet, where the locations are clearly identified by their name:

With the binds-to-display-name locations are presented as names instead of numbers

 

The complete AIMMS 24.5 example project can be found attached. This project also illustrates the use of range-display-name.

Hi @Chris Kuip @MarcelRoelofs , nice feature and example! I’ve tested this in one of my own projects and works nicely. 👍

I’ve seen that the text is collected during the call to

AddMapping()

My request/ use case would be to see if that could be decoupled (or refreshable). With refreshable I mean that the current contents of the registered 1-dim string par can be ‘pushed’ towards dex again via a procedure that the dex library will expose.

Suppose in the UI (or via some upload) you add Dientes de Navarino as new location with ID = 4. In the WebUI that will directly work with elementText.

Other use case if you would change a name of an already existing location during your session. Assuming here that you typically as part of the app initialization you would only once generate the mappings.

I think currently for these cases you would have to delete (all?) mappings and regenerate them, to get the desired output in a file. It is an option though.

Best Joost


Hi ​@Joost 

DEX 24.7.1.1 will automatically update the display names on every call to dex::ReadFromFile and dex::WriteToFile whenever necessary. It will also throw an error if you use different display name identifiers for the same index/range set.

 

 


Hi Marcel, that is a nice addition! This will most likely help us to simplify some apps in quite an impactful way, Cheers, Joost


Reply


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator