How to apply SQL code to a certain row, Table transformer

Ksenia Potroklova
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 4, 2022

Good day!

I have a table and would like to apply a code only to 2d row, and all further rows without code. 

My current code is below 

SELECT *,
(T1.'SC' - "120d")::Date->toLocaleDateString("en-AU") AS 'Verg specials',
FROM T1

 

when i publish it, all other rows get result invalid date 

Knipsel.PNG

2 answers

2 votes
Katerina Kovriga {Stiltsoft}
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 8, 2022

Hi there,

As this question mentions our Table Filter and Charts for Confluence app, we are happy to introduce its new macro – Table Spreadsheet.

This new macro allows you to work with fully functional Excel spreadsheets right in Confluence. You’ll be able to use cells’ formulas, filters, conditional formatting, etc., create pivot tables and charts from the page view and edit modes.

The Table Spreadsheet macro is available for Cloud and Server/Data Center.

2 votes
Katerina Kovriga {Stiltsoft}
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 4, 2022

Hi @Ksenia Potroklova ,

Try to use conditions to exclude other rows - for example, here I exclude empty cells:

SELECT *,
CASE WHEN T1.'SC' IS NOT NULL
THEN (T1.'Date' - "120d")::Date->toLocaleDateString("en-AU")
END
AS 'Verg specials'
FROM T1

I also see that your third row is meant to contain text - maybe it will be better to rethink the table structure? The Table Transformer macro works with columns, not with rows. So, you may split your table into two tables, work with the part that contains dates (wrap it into the Table Transformer macro) and then with the help of another outer Table Transformer macro combine the tables back with the help of the standard Merge preset?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events