Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi experts
I have the following problem:
In my script I generate 2 fields like the following:
Load
jobnr,
sum(Rohertrag) as Rohertrag_total_AP,
sum(VK_soll) as VK_soll_total_AP
resident job where Gesellschaft = 'AP' group by jobnr;
and
Load
jobnr,
sum(Rohertrag) as Rohertrag_total_APVJ,
sum(VK_soll) as VK_soll_total_APVJ
resident job where Gesellschaft = 'AP' AND datum_auftrag < Date(AddYears(Today(),-1)) group by jobnr;
Now I would like to calculate Rohertrag_total_AP/Rohertrag_total_APVJ as a new field, say X. How is this done? If I enter another load statement I do not get an error. But the new field does not appear.
Thank you for your help!
Jan
Hi
To enter expressions click 'Advanced Mode' (Erweiterter Modus on your dialog). This will take you to the normal expressions dialog where you can enter expressions in the same way as other charts.
HTH
Jonathan
In the front end (Chart) you can do it in expression without problems,
in script you have to join the tables, the resulting table will have both the field then you can divide them
Hope it helps
Hi Alessandro
Thank you for your help
Problem with the chart is, I would like to use a point diagramm. This does not allow me to calculate values.
The chart is of course the way I would prefer to solve the problem, too.
Best
Jan
So the only way is to join table
Hi Alessandro
Sorry to bother you again. Can I join resident ables the same way I join other tables? I also do different seclections after the resident statement.
Thank you for your help!
Jan
Hi
To enter expressions click 'Advanced Mode' (Erweiterter Modus on your dialog). This will take you to the normal expressions dialog where you can enter expressions in the same way as other charts.
HTH
Jonathan
Resident can be used as normal tables, generally is always (when is possible) better to compute script side expression to reduce execution time
Hi Jonathan
I do not seem to find this option. Under which caption is it located?
Best
Jan
Hi,
Try like this
Temp:
Load
jobnr,
sum(Rohertrag) as Rohertrag_total_AP,
sum(VK_soll) as VK_soll_total_AP
resident job where Gesellschaft = 'AP' group by jobnr;
LEFT JOIN(Temp)
Load
jobnr,
sum(Rohertrag) as Rohertrag_total_APVJ,
sum(VK_soll) as VK_soll_total_APVJ
resident job where Gesellschaft = 'AP' AND datum_auftrag < Date(AddYears(Today(),-1)) group by jobnr;
Data:
LOAD
*,
Rohertrag_total_AP/Rohertrag_total_APVJ AS NewField
FROM Temp;
DROP TABLE Temp;
Hope this helps you.
Regards,
Jagan.
Data:
Load
jobnr,
sum(Rohertrag) as Rohertrag_total_AP,
sum(VK_soll) as VK_soll_total_AP
resident job where Gesellschaft = 'AP' group by jobnr;
Join
Load
jobnr,
sum(Rohertrag) as Rohertrag_total_APVJ,
sum(VK_soll) as VK_soll_total_APVJ
resident job where Gesellschaft = 'AP' AND datum_auftrag < Date(AddYears(Today(),-1)) group by jobnr;
Final:
NoConcatenate
LOAD *,
Rohertrag_total_AP/Rohertrag_total_APVJ as X
Resident Data;
DROP Table Data;