Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have loaded a table as follows by this SQL Query in QlikSense data load editor,
[RESOURCE_ALLOCATION]:
select t.rec_id as RESOURCE_ALLOC_TASKID,
t.name as RESOURCE_ALLOC_TASKNAME,
t.actual_starttime as RESOURCE_ALLOC_STARTTIME,
t.actual_endtime as RESOURCE_ALLOC_ENDTIME,
extract(year from t.actual_starttime) as RESOURCE_ALLOC_YEAR,
(t.actual_endtime - t.actual_starttime) as RESOURCE_ALLOC_DAYS,
t.resource_id as RESOURCE_ALLOC_ERSOURCEID,
r.name as RESOURCE_ALLOC_ERSOURCENAME
from public.dsh_project_tasks t, public.dsh_resources r
where t.resource_id = r.rec_id and extract(year from t.actual_starttime) = extract (year from t.actual_endtime);
Then I am tring to load another table by selecting from the last loaded table [RESOURCE_ALLOCATION] by another Query just after the one above in the load data editor , as follows
[Resource_Utilization]:
load rr.RESOURCE_ALLOC_ERSOURCENAME as busy_resourcename,
rr.RESOURCE_ALLOC_YEAR as busy_resourceyear,
Sum(rr.RESOURCE_ALLOC_DAYS) as busy_resourceDays,
if(Sum(rr.RESOURCE_ALLOC_DAYS) < 368, 'busy', 'free')as BUSY_RESOURCESTATUS
from RESOURCE_ALLOCATION rr
group by rr.RESOURCE_ALLOC_ERSOURCENAME, rr.RESOURCE_ALLOC_YEAR;
[Resource_Utilization]:
load rr.RESOURCE_ALLOC_ERSOURCENAME as busy_resourcename,
rr.RESOURCE_ALLOC_YEAR as busy_resourceyear,
(365 - Sum(rr.RESOURCE_ALLOC_DAYS)) as busy_resourceDays,
if((365 - Sum(rr.RESOURCE_ALLOC_DAYS)) < 366, 'free', 'busy') as BUSY_RESOURCESTATUS
from resource_allocation rr
group by rr.RESOURCE_ALLOC_ERSOURCENAME, rr.RESOURCE_ALLOC_YEAR;
But I have an error in load data , saying
The following error occurred:
Invalid Path
The error occurred here:
[Resource_Utilization]: load rr.RESOURCE_ALLOC_ERSOURCENAME as busy_resourcename, rr.RESOURCE_ALLOC_YEAR as busy_resourceyear, Sum(rr.RESOURCE_ALLOC_DAYS) as busy_resourceDays, if(Sum(rr.RESOURCE_ALLOC_DAYS) < 368, 'busy', 'free')as BUSY_RESOURCESTATUS from RESOURCE_ALLOCATION rr group by rr.RESOURCE_ALLOC_ERSOURCENAME, rr.RESOURCE_ALLOC_YEAR
Please help, why Do I get this error although same Query is selecting data well in DB console??
Hi Shaima,
Resident RESOURCE_ALLOCATION (without rr) instead of From.
Regards,
Antonio
Load statement syntax has something with it,
when replaced with 'Select .. from' Statement and 'Case.. When ..' instead of 'if..else..'
Yes, I can use 'select' with a local
[Resource_Utilization]:
select r.RESOURCE_ALLOC_YEAR as busy_resourceyear,
r.RESOURCE_ALLOC_ERSOURCENAME as busy_resourcename,
Sum(r.RESOURCE_ALLOC_DAYS) as busy_resourceDays,
(case when Sum(r.RESOURCE_ALLOC_DAYS) < interval '368 Days' then 'On task' else 'Free' end) as BUSY_RESOURCESTATUS
from RESOURCE_ALLOCATION r
group by r.RESOURCE_ALLOC_ERSOURCENAME, r.RESOURCE_ALLOC_YEAR;
[Resource_Utilization]:
select r.RESOURCE_ALLOC_YEAR as busy_resourceyear,
r.RESOURCE_ALLOC_ERSOURCENAME as busy_resourcename,
(interval'365 Days' - Sum(r.RESOURCE_ALLOC_DAYS)) as busy_resourceDays,
case when (interval'365 Days' - Sum(r.RESOURCE_ALLOC_DAYS)) < interval '366 Days' then 'Free' else 'On task' end as BUSY_RESOURCESTATUS
from resource_allocation r
group by r.RESOURCE_ALLOC_ERSOURCENAME, r.RESOURCE_ALLOC_YEAR;