Set labels value

0
Hello, I am still new at this. I have a data grid and a corresponding data view. On the data view I want to display a concatenated value in a label when the user selects a row from the master data grid. I could not find any way to do this. Should I use javascript for this?
asked
3 answers
1

Instead of usingthe FormatString widget as suggested by Lex, I would advise using the the 'native' Mendix Text widget (Common > Text). In the properties of this widget you can also configure attributes to be replace. This configuration can be found under General > Text.

See Refguide 5 > Text widget

This widget is available since Mendix 5.19.

To further add on the comment given by Lex. If your are going to display this calculated ProjectCode a lot. It would be smart to just store it in the database. It will be a performance improvement to not have to calculate the ProjectCode every time. You could consider using Event Handlers to automatically calculate and store the ProjectCode.

answered
0

Trying to get a good visualization on what you want, but I think you are OK if you grab the FormatString widget in the Appstore. That will take attributes from the record selected in the Grid and allow you a formated display in the Dataview

answered
0

Thank you for response. I'll try to be a bit clearer. I have two data attributes called ProjectID and ProjectAbbreviation. These two fields are stored separately in the DB as part of a single Entity. I want to combine these two fields and create a ProjectCode value (only in memory for display purposes. On the UI I have a master-detail view where there is a list of projects (master which is a data grid widget) and then the detail below (which is data view widget). When the user selects a project from the master data grid I want to "calculate" the ProjectCode value by concatenating the ProjectID and ProjectAbbreviation fields and then update a label (called lblProjectCode) with this value.

I had a look at the format string widget but looks like it only takes one attribute?

Correction: After I posted this response I played around with it and I did get it working using the format string widget. Thank you very much!

answered