Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

I need to filter out the start date and end date and get a duration for this.

patro October 14, 2022

I already have page with table filter in it and easy heading macro

 

So My question here  I have target completed date and Start date and Ageing 

and when I write this command SELECT *, (T1.'Target completion date' - T1.'Start date') / "24h" AS 'Ageing' FROM T1 ,  it is not giving any output 

I have created a table transformer and I have placed this table in that and saved it. It display nothing in Ageing

 

but when I only create a table transformer and paste a table with no macro/filter as the 2nd pic and 3rd pic with same command SELECT *, (T1.'Target completion date' - T1.'Start date') / "24h" AS 'Ageing' FROM T1  , the Ageing is displayed.

 

Please help in this thanks in advanceageing.PNGconfluence1.PNGconfluence2.PNG

1 answer

1 accepted

4 votes
Answer accepted
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.
October 14, 2022

Hi @patro ,

The macro sequence "source table <- Table Transformer <- Table Filter" is a standard common case, so everything should be working fine.

You may check if the date format in the not working Table Transformer macro corresponds the date format used in the table. Go to the Settings -> Date Format and choose the "d M yy" option.

You may also use the autocomplete while typing in your query: type "T1." and choose the required columns from the dropdown menu.

Please try these hints and tell me if they helped.

Besides (it doesn't concern the case) you don't need to create a blank "Ageing" column in your table. This column will be automatically created and filled in by the query.

patro October 14, 2022

hi @Katerina Kovriga _Stiltsoft_ 

The date format is this as highlightedconfluence3.PNG

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.
October 14, 2022

You need to check the format inside the Table Transformer macro: go to the Settings tab -> Date Format and choose the "d M yy" option.

Like # people like this
patro October 14, 2022

It worked thanks a lot confluence4.PNG

Like # people like this
patro October 16, 2022

Hello, Though the difference date are obtained with the above solution provided.

Now it is observed that from 5th Oct to 24th oct, it should give 14 days in Ageing(Number of days )column excluding the weekends and Days should display 20

when I used this query 

SELECT *,
'Days' -
2 * (('Days' / 7)::integer) -
CASE
WHEN 'Days' % 7 = 0 THEN 0
WHEN 'Start date'::Date->getDay() = 0 THEN 1
WHEN 'Start date'::Date->getDay() + 'Days' % 7 = 7 THEN 1
WHEN 'Start date'::Date->getDay() + 'Days' % 7 > 7 THEN 2
ELSE 0
END AS 'Ageing(Number of days)'
FROM
(SELECT *,
ROUND((T1.'Target completion date' - T1.'Start date') / "1d") + 1 AS 'Days'
FROM T1)

 

Its giving this 

Att.PNG

 

Could you Please in this. where am I going wrong

patro October 16, 2022

att1.PNG

patro October 16, 2022

hi @Katerina Kovriga _Stiltsoft_ 

Got ageing date correctly but need to filter out the workdays only 

Now it is showing with respect to seven days but need it for 5 days to exclude weekends

att2.PNG

Query is this:

select *,
CASE WHEN T1.'Target completion date' IS NOT NULL AND T1.'Start date' IS NOT NULL THEN
ROUND(('Target completion date' - 'Start date' + "24h") / "24h") + " days"
ELSE "" END
as 'Ageing(Number of days)' from T1

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.
October 17, 2022

Hi @patro ,

I've recreated an example from our documentation and it's working fine for me:

Mon 13-1.png

SELECT *,
'Days' -
2 * (('Days' / 7)::integer) -
CASE
WHEN 'Days' % 7 = 0 THEN 0
WHEN 'Start date'::Date->getDay() = 0 THEN 1
WHEN 'Start date'::Date->getDay() + 'Days' % 7 = 7 THEN 1
WHEN 'Start date'::Date->getDay() + 'Days' % 7 > 7 THEN 2
ELSE 0
END AS 'Work days'
FROM
(SELECT *,
ROUND((T1.'Target completion date' - T1.'Start date') / "1d") + 1 AS 'Days'
FROM T1)

Mon 13-2.png

Try to set the date format as any other that differs from your original format in the table: M dd, yy, for example.

If it doesn't help, please raise a support request: attach the page storage format (upper right corner of the page -> menu ... -> View storage format). We'll recreate your table and look into the issue.

Like # people like this
patro October 18, 2022

@Katerina Kovriga _Stiltsoft_ it didn't work I have created a issue and attached the query 

I even changed the date format 

Please find the ticket number

https://jsd.stiltsoft.com/servicedesk/customer/portal/2/TFCS-1937

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.
October 18, 2022

Hi @patro ,

Thank you, I see the ticket and that you are already engaged in conversation with Nikita - he is one of our support engineers. The issue should be solved soon. Thank you for reaching out!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events