Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have below script that has no problem but ecounter Invalid expression once I add null condition.
Would appreciate experte guidance to make the correction. Many thanks.
No issue in below script
load Distinct
key,
sum(timeSpentSeconds) as timeSpentSeconds,
if((sum([timeSpentSeconds])/60/60/8)>1,round(sum([timeSpentSeconds])/60/60/8)&'d', frAC(sum([timeSpentSeconds])/60/60/8)*8&'h')as [timeSpent_day_logged]
resident Worklog
group by key;
Drop table Worklog;
Invalid expression in below script
load Distinct
key,
sum(timeSpentSeconds) as timeSpentSeconds,
if(isnull([timeSpentSeconds]),'not specified',(if((sum([timeSpentSeconds])/60/60/8)>1,round(sum([timeSpentSeconds])/60/60/8)&'d', frAC(sum([timeSpentSeconds])/60/60/8)*8&'h')))
as [timeSpent_day_logged]
resident Worklog
group by key;
Drop table Worklog;
You may try:
load Key, coalesce(Expr, 'default) as Value from X group by Key;
Can you share some data? This is what I am using and it works for me.
Worklog:
load
1 as key, Null() as timeSpentSeconds
AutoGenerate(1);
load
2 as key, 100 as timeSpentSeconds
AutoGenerate(1);
newtab:
NoConcatenate
load Distinct
key,
sum(timeSpentSeconds) as timeSpentSeconds,
if(count([timeSpentSeconds])=0,'not specified',
(if((sum([timeSpentSeconds])/60/60/8)>1,round(sum([timeSpentSeconds])/60/60/8)&'d', frAC(sum([timeSpentSeconds])/60/60/8)*8&'h')))
as [timeSpent_day_logged]
resident Worklog
group by key;
Drop table Worklog;
exit Script;
Thank a lot to all experts for giving me many solutions. After many trial and check, I have found that the "-" is because my table was joining another table and some of the value do not exist in the other table
So I use applymap instead and fix the problem.
Regardless, Thank you so much for your guidance. I have learned a lot more through the discussion.