Solved

How to change unit and decimals by parameters?

  • 6 February 2020
  • 8 replies
  • 433 views

Userlevel 5
Badge +5

Hi everyone!

 

Is there a way to change if I want to show or not the unit and the number of decimals by parameter?

 

Example: 

 

My wish:

500     |     0.00%

 

Thanks.

icon

Best answer by mohansx 8 February 2020, 00:28

View original

8 replies

Userlevel 1
Badge

Thank you @gabiservidone for asking. Can I check with you, are you aware of this feature https://documentation.aimms.com/webui/widget-options.html#number-of-decimals ? You can pass an AIMMS identifier to dynamically adjust the number of decimals or use the static value directly.

Userlevel 5
Badge +2

Hi @laithshadeed .

Thanks, we already checked that! However, both “number of decimals” and “show units” fields only allow a binary parameter or static values (1/0) that would apply the format to all contents within the widget.


In our use case, we have a table with different contents, thus we wanted to be able to show unit for parameter 0 % and do not show for parameter 500 ton. Is this possible?

 

FYI, we tried to create a binary parameter indexed in IndexIdentifers (P_ShowUnits(IndexIdentifiers)) to set “1” for content [%] and “0” for content [ton], but the fields “show units” and “number of decimals” didn’t allow us to use this binary parameter there.

Userlevel 5
Badge +5

@mateusarakawa , at this point of time - widget options like show/hide units, number of decimal points etc. are applied to the entire table. Different values for different contents in the table is not possible. There are plans to change this in a future version. 

One workaround could be to use an intermediate string parameter - formatting the values and units as you want it to be displayed.

Userlevel 6
Badge +6

One of the items we are currently working on is to adjust the way Widgets are setup structurally (backend) - this is required to be able to support this. Once done, it will allow a more fine grained control of eg setting properties per identifier next to ‘just’ the complete widget level properties. Think of decimals, units, etc. Idea is that under normal conditions the properties declared on widget level holds unless the identifier has a specified one.
 

Example: widget level decimals is 0 so all identifiers show 0 decimals except for IdentifierX, who shows 2 decimals.

 

Please expect an update on this in the next months to come either via the PO update or this Community. Do share with ‘identifier’ properties you like to have control over independently of other identifiers as this is great input to have!

Userlevel 5
Badge +5

Thanks @Gertjan  and @mohansx for the update. Changing to string parameters seems to solve the problem, but I will probably wait for this new development. And for now, we thought that the following may help. 

  • Hide/unhide;
  • Letter coloring;
  • Background coloring;
  • Units;
  • Decimals;
  • Column width.
Userlevel 4
Badge +7

One of the items we are currently working on is to adjust the way Widgets are setup structurally (backend) - this is required to be able to support this. Once done, it will allow a more fine grained control of eg setting properties per identifier next to ‘just’ the complete widget level properties. Think of decimals, units, etc. Idea is that under normal conditions the properties declared on widget level holds unless the identifier has a specified one.
 

Example: widget level decimals is 0 so all identifiers show 0 decimals except for IdentifierX, who shows 2 decimals.

 

Please expect an update on this in the next months to come either via the PO update or this Community. Do share with ‘identifier’ properties you like to have control over independently of other identifiers as this is great input to have!

Hi Gertjan,

 

is this already possible in the current version? I was not able to find it at least. If it is not possible, is there any update with regards to when this might be added?

Also explicit visible/hidden option per identifier would be really nice (although my guess is that you can work around that by using the index domain per identifier and set it explicitly to 0?

Userlevel 2
Badge +4

Hi @gdiepen 

Thanks for the followup.
We have started with incorporating Identifier specific options through which you could control the Show-Units and Num-Decimals for the charts.

This was demoed it our last WebUI Webinar. See the recording here.

 

We will first implement it for Charts and later get it onto Table widget (Tentative around Q2-2022).

 

Thanks for the suggestion on the visibility option per identifier. We thought about and would take it to our backlog.

 

Thanks,

Madhu K

Userlevel 4
Badge +7

Hi Madhu,

 

was wondering if there is any update about this for tables. In your last message you stated tentative for Q2-2022, but I can’t seem to find any information about this.

Whenever displaying different identifiers in one table, for some of these I would really like to show one or two decimal positions, while for others I don’t want to and just show the integer component.

 

I know that I can achieve this by making all of my numerical parameters I want to use in the table be represented by string parameters and use the webui::uponchangeprocedure for all of these string parameters to call a procedure that checks if what was entered was a numerical value. If so, then update the underlying numerical parameter with this new value and also update the string representation with this again also. But, in the uponchangeprocedure, I will also have to check if what the user provided was actually a numerical representation, and if not, provide an error to the end-user. Also, might have to deal with thousand separators also (which the AIMMS val function cannot handle as far as I know).

This seems like a lot of boilerplate code that needs to be written/maintained  for every table where you have a combination of decimal places.

Is there any other (preferably easier 😉 )way than the above workaround or is it even already natively possible?

 

Reply


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

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