Solved

Changing fieldname for multiple indexes

  • 12 March 2024
  • 6 replies
  • 66 views

Badge

I have one set - Modes, with multiple indexes, mp, m, and mn. These translate to Previous Mode, Current Mode, and Next Mode.

In WebUI, I have a table with a parameter that includes two of these indexes, Previous Mode and Current Mode.

I’d like to change the name of mp to be Previous Mode and m to be Current Mode. It seems, though, that in fieldnames.properties, I can only change the name of the set (Modes). 

 

Any ideas? 

icon

Best answer by Madhu Krishnappa 13 March 2024, 08:28

View original

6 replies

Userlevel 5
Badge +7

I recently had the exact same problem and I am not sure what the best solution is.

I did find a workaround that appears to solve my problem, which might also work for you.

Instead of defining the indices on the same set, I just created additional sets in AIMMS, one for each index I would like to use a different name for in the webui. I made these sets a subset of the original set Modes and by definition give them the exact same elements as the root set Modes.

Now if you display the parameter in the WebUI, you can give separate names in the fieldnames.properties for each of the separate subsets.

 

 

It feels like a bit hacky workaround, but it did solve the problem for me.

Maybe the AIMMS people can give a solution that feels less hacky (and also introduces less additional identifiers)? If there is no cleaner solution, is it on the backlog to be able to give a properties name per separate index maybe?

Userlevel 3
Badge +5

Hi @robb and @gdiepen

 

I'm pleased to inform you that the WebUI indeed offers support for the use case you've mentioned. This feature was introduced in the AIMMS 4.89.1 Release.

By leveraging the webui::IdentifierElementText() procedure, you can customize display names for your identifiers and indices, ensuring clarity and meaning in your WebUI.


For Sets:
You can assign meaningful display names to each index. For instance, if you have a Set named "Modes" with multiple indices (mp, m, and mn), you can use the following code in your PostMainInitialization procedure:

webui::IdentifierElementText('mp') := "Previous Mode";
webui::IdentifierElementText('m') := "Current Mode";
webui::IdentifierElementText('mn') := "Next Mode";

For other Identifiers:
Simply provide the identifier name as the argument to the procedure:

webui::IdentifierElementText('InputDataIdentifier') := "Input Data";

By doing so, your identifiers and indices will display with clear and meaningful names in the WebUI.

Here is an example of a table before implementing these changes:

After applying these changes:

 

Additionally, you can enhance user experience by using webui::IdentifierTooltip() to provide meaningful tooltips when hovering over identifiers and indices on the WebUI.

Note:
We've noticed conflicts arising when utilizing both webui::IdentifierElementText() and .properties for assigning meaningful names to your Identifiers and Indices.
We strongly advise opting for the webui::IdentifierElementText() feature over translations through .properties to avoid such conflicts.

I hope this information proves helpful.

Feel free to reach out if you have any questions or need further assistance.

Warm regards,
Madhu Krishnappa
AIMMS WebUI Product Owner

Userlevel 5
Badge +7

Thanks for this info @Madhu Krishnappa!

 

So far I have been using the properties files for this (with the above mentioned workarounds for different header titles), but this seems to be a much better solution.

 

Guess I need to go over the section https://documentation.aimms.com/webui/library.html in a bit more detail again 😉

Badge

Hi @robb and @gdiepen

 

I'm pleased to inform you that the WebUI indeed offers support for the use case you've mentioned. This feature was introduced in the AIMMS 4.89.1 Release.

By leveraging the webui::IdentifierElementText() procedure, you can customize display names for your identifiers and indices, ensuring clarity and meaning in your WebUI.


For Sets:
You can assign meaningful display names to each index. For instance, if you have a Set named "Modes" with multiple indices (mp, m, and mn), you can use the following code in your PostMainInitialization procedure:

webui::IdentifierElementText('mp') := "Previous Mode";
webui::IdentifierElementText('m') := "Current Mode";
webui::IdentifierElementText('mn') := "Next Mode";

For other Identifiers:
Simply provide the identifier name as the argument to the procedure:

webui::IdentifierElementText('InputDataIdentifier') := "Input Data";

By doing so, your identifiers and indices will display with clear and meaningful names in the WebUI.

Here is an example of a table before implementing these changes:

After applying these changes:

 

Additionally, you can enhance user experience by using webui::IdentifierTooltip() to provide meaningful tooltips when hovering over identifiers and indices on the WebUI.

Note:
We've noticed conflicts arising when utilizing both webui::IdentifierElementText() and .properties for assigning meaningful names to your Identifiers and Indices.
We strongly advise opting for the webui::IdentifierElementText() feature over translations through .properties to avoid such conflicts.

I hope this information proves helpful.

Feel free to reach out if you have any questions or need further assistance.

Warm regards,
Madhu Krishnappa
AIMMS WebUI Product Owner

Thanks, @Madhu Krishnappa ! This is great. One follow up question - my model does not have a PostMainInitialization procedure. The model was created many years ago, though I am currently using aimms version 4.95. If I create the procedure myself next to the MainInitialization procedure, would that work? Will AIMMS still run the PostMainInitialization procedure automatically?

Userlevel 5
Badge +6

Hi @robb! Yes, it will! 😀

Badge

Hi @robb! Yes, it will! 😀

Thanks, @gabiservidone!

Reply


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

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