cancel
Showing results for 
Search instead for 
Did you mean: 

To print string/text

MadhuraK
7 - Data Storage
7 - Data Storage

Hello,

Can someone help me to understand how can we print string/text in Sisense? Which command can we use? How to use it?

5 REPLIES 5

Silutions
10 - ETL
10 - ETL

Please give an example.  Is this text from an ElastiCube/LiveModel or simply text you wish to 'hard code' on a dashboard.

Regards, Jim

Hello Jim,

Thank you for quick response. I want to print simply text. 

Example: Case When Sales<0.3, then it should print text "Low".

I have multiple such conditions where text varies basis sales percentage. 

harikm007
12 - Data Integration
12 - Data Integration

@MadhuraK ,

If I understood the problem correctly, there are 2 options I was able to find:

1. Use Advance Formula plugin - https://www.sisense.com/marketplace/advanced-formula/

2. Use numbers in formula and replace it with required text using script.

For example : Case When Sales<0.3 then 1 else 0 end. Then replace 1 and 0 with required text using script.

Here is an example for how to replace string in pivot2 - https://community.sisense.com/t5/build-analytics/pivot2-replace-a-value-in-a-specific-value-in-anoth...

-Hari

 

Hari,

Seems like the widget script it the best approach, but I think you noted in the script you created for me that it doesn't work on numbers from the values panel.  I think that is what MadhuraK needs.

MadhuraK - if you change Hari's script slightly to this:

//Replace cell values with another value in a specific column
//Works on numbers from VALUES Panel.  Does not work values from ROWS panel.
widget.transformPivot(
    {
        type: ['value']
    },
    function setCellBackground(metadata, cell) {
columnIndex = 2  // SET COLUMN INDEX TO CORRECT COLUMN. NOTE: INDEXES START WITH 0
if(metadata.colIndex == columnIndex)
{
cell.style = cell.style || {};
if(cell.content < '0.3')  // REPLACEMENT LOGIC STARTS HERE
cell.content = 'Low'
else if(cell.content < '0.5')
cell.content = 'Med'
}
    }
);
 
This will work if you only need to replace the value in a single column in Pivot2.
- Jim

Hello Hari and Jim,

 

Thank you for the response. I tried the widget script and could print desired string. 

However I could not download the report in excel/pdf format. Is there any way to download the report?