Data Handling
Data handling involves performing various operations on data, such as querying, filtering, aggregating, and transforming. I’m trying to perform these queries (join and group) on the esProc desktop, but I got stuck at some point where I couldn’t see my whole row. What should I do to get all the rows?
SPL Official Website 👉 https://www.scudata.com
SPL Feedback and Help 👉 https://www.reddit.com/r/esProc_SPL
SPL Learning Material 👉 https://c.scudata.com
SPL Source Code and Package 👉 https://github.com/SPLWare/esProc
Discord 👉 https://discord.gg/cFTcUNs7
Youtube 👉 https://www.youtube.com/@esProc_SPL
Please paste your script. maybe the result set has only 1 row.
Thanks, but my result set does not have only one row. Thus I have uploaded the script I used.
In A4, you should use field name like “countrylanguage.CountryCode”,“countrylanguage.Language”,“country.Name”,….
View A3, and you will see the field names of the table, there is no field named A1,A2.
A1,A2 is the intermediate variable name, after executing A3, they don’t exist in A3’s value.
The A1,A2 in A4 will be explained as the cell A1,A3, and A1.CountryCode means the A(1).CountryCode(first row). so the result of A3 would consist of many same rows, and then after grouping, A4 would have only 1 row.
BTW, xjoin is not the most appropriate function here, it runs slower.
You can use join:
A3= A1.join(CountryCode, A2:Code, Name, Populcation, Continent)
And write A4’s code according to the result in A3.
A4 is trying to perform grouping, but there is no aggregation expression, maybe you have not finished the code.
The datasouce is from MySQL. I think the calculation can also be done in one SQL statement:
SELECT … FROM country JOIN contrylanguage ON countrylanguage.CountryCode=country.Code
SPL has very different concept of JOIN from SQL.
Here is a brief introduction: https://c.scudata.com/article/1686883667617#toc_h2_19
For non-professional programmer(user of esProc desktop), we recommend the book: http://c.raqsoft.com/article/1638237297732
Hi, good day! I have another issue!
How can I aggregate this data to get the average life expectancy grouped by continents and filtered by population > 10000000?
This should be my result set.
You use wrong symbols in A3’s expression “=A2.groups(Continent, avg(LifeExpectancy))”.
Just change it to “=A2.groups(Continent; avg(LifeExpectancy):AvgLifeExpectancy)” and the code will work.