cancel
Showing results for 
Search instead for 
Did you mean: 

Add measure value in a Text Box in SAP Analytics Cloud

sarthaksrivasta
Explorer
0 Kudos
4,971

Hello All,

I am trying to display aggregated sum of a Measure value in a Text box.

I am able to display Measure Name using a Global script variable and then assigning a default value to it

But could not display measure value.

Is it possible to do so?

Thanks,

Sarthak Srivastava

Accepted Solutions (0)

Answers (5)

Answers (5)

former_member573632
Discoverer

Hi Sarthak,

I am able to achieve the same using script in SAP Analytics Cloud Application Designer.

We need to find the measure class and the id. You can take the help of console function and get the measure class and ID of measure you want to refer.

console.log(Chart_1.getDataSource().getMeasures());

After getting the desired measure ID from console log. you can use the below code to populate text with measure value.

Text_2.applyText(Chart_1.getDataSource().getData({"@MeasureDimension": "[Account].[parentId].&[Size]"}).formattedValue);

Regards,
Hithesh

dmitry_kuznetsov1
Active Participant
0 Kudos

Hi Hithesh,

This is a really nice one. Thank you.

Dmitry Kuznetsov

nikhil_joy2
Active Contributor
0 Kudos

Hi,

Able to do it with a selection in another component. Yet to find something equivalent to DS_1.getData(measure,selection:{}).formattedvalue; in Design Studio to show aggregated value without interaction.

-Nikhil Joy

sarthaksrivasta
Explorer
0 Kudos

Hello nikhil.joy2 ,

Yes in Business object Design Studio we have a function getDataasString() for this same use case, But cannot find the same for SAC.

Thanks,

Sarthak Srivastava

TuncayKaraca
Active Contributor
0 Kudos

Hi Sarthak,

You can still do it with Numeric Point chart while you are creating a story. It's little bit tricky and certainly there will be cases that will be very handy.

Text + Numeric Point Chart + Text

former_member258682
Participant
0 Kudos

Hello tuncay.karaca ,

I agree its a good method, but I still wanted to know how can we do it using a script.

For example I can fetch a dimension column data using this in Analytics designer:

Chart_Name.getDataSource().getMembers("DimensionName");

Similarly there must be a way to extract measure values too.

If I can do it I can then set this value as a global script and use it in a Dynamic Text.

Thanks & Regards,

Sarthak Srivastava

TuncayKaraca
Active Contributor
0 Kudos

Sarthak,

Here is how you do it:

var vDataCell = tableAuth.getDataSource().getData(tableAuth.getSelections()[0]);
textCompany.applyText("Company raises ".concat(vDataCell.formattedValue));

Once you click Gross Margin data cell it updates the text.

Thanks,
Tuncay

sarthaksrivasta
Explorer
0 Kudos

Hi nikhil.joy2,

Thank you for reply, But I know about this graph,

What I am trying to do is display multiple measures in a sentence:

Example:

Company raises <Cost from DataSource> more funds.

This might be possible in Analytics Application in SAC but I am not able to find the exact function to use for this case.

Thanks,

Sarthak Srivastava

nikhil_joy2
Active Contributor
0 Kudos

Hi Sarthak,

Are you trying to show something like this? Or specific about showing measure in text box?

-Nikhil Joy