Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Table Transformer: Check if a column exists. If yes, rename the column.

I am using 'Table Transformer' macro to pull out JIRA issues and their status using a JQL.

Let's assume that my query returns 3 issues with following statuses:

  1. Defect A with 'Open'
  2. Defect B with 'Closed'
  3. Defect C with 'In Progress'

Also, I am renaming the columns in my query for some reasons, something like:

SELECT T1.'Labels' as 'Project', 
T1.'Count Closed' as 'Closed',
T1.'Count OPEN' as 'Open',
T1.'Count In Progress' as 'In Progress',
From T1 WHERE T1.'Labels' in (<my customer labels for JIRAs>);

And now let's assume that Defect 'C' was moved from 'In Progress' to 'Code Review'.  But now the same query returns the error:

Column does not exist: Count In Progress

This is resulting in frequent page breaks. How can I add a condition in such a way that rename a column only if it exists?

1 answer

1 accepted

4 votes
Answer accepted
Stiltsoft support
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.
Nov 21, 2023

Hi @Shantharam ,

You may use the COALESCE function for the case. In my example I'm sure that 'Text 1' and 'Text 3' columns are always present but 'Text 2' column may or may not be present:

SELECT
'Text 1' AS 'New 1',
'Text 3' AS 'New 3',
COALESCE('Text 2',"") AS 'New 2'
FROM T*

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events