Use case
You need visualize the numbers representing progression in a table.
Solution
- Switch the page to the edit mode.
- Insert the Table Transformer macro and paste the table within the macro body.
- Select the macro and click Edit.
- Switch to the SQL query tab.
Enter the following SQL query:
SET @maxProgress = (SELECT FORMATNUMBER(40) FROM T1); /* set the number representing the 100% progression in this variable or use MAX('Your Column Name') instead of the FORMATNUMBER() function to determine the value */ SELECT *, FORMATWIKI("{cell:background-image: linear-gradient(to right, #4caf50, #4caf50); background-repeat: no-repeat;background-size:"+ 'Progress Bar' +" 50%;background-position-y: 50%;}", 'Progress Bar', "{cell}") AS 'Progress Bar' FROM (SELECT *, T1.'Progress'/@maxProgress * 100 + "%" AS 'Progress Bar' FROM T1);
- Click Next.
- Save the macro and the page.