Skip to Content
0
Jun 17, 2021 at 11:46 AM

SAC APP Designer - How to display selected value in a text cell

1046 Views Last edit Jun 17, 2021 at 11:50 AM 3 rev

Just wondering if anyone has an idea on how to achieve the following:

Requirement:
When I click on the table I'd like the clicked value to be shown in the text box.
Could be either a dimension or measure - from any column/row in the table.

e.g. If I click the value 'Los Angeles' - that's what is shown in the text box
or I could click 0.09 in the Quantity sold column , so I'd want to see 0.09 in the text box.

I've got it partially working, just not fully dynamic (a user could click any cell in the table)

For the dimensions I can only get it working via hardcoding a dimension (so doesn't really deliver what I want)

var sel = tbl.getSelections()[0];
var result = tbl.getDataSource().getResultMember("Product_3e315003an",sel).description;
txt_box.applyText(result)

For measures this works

var sel = tbl.getSelections()[0];
var value = tbl.getDataSource().getData(sel).formattedValue;
txt_box.applyText(value);

So i need to find a way to wrap it all into one script that dynamically puts whatever value is clicked in the text box
and can dynamically tell which dimension has been clicked.

Attachments

cell-value.png (19.2 kB)