Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
gilldilpreet
Contributor III
Contributor III

Adding expression to load script

Hi,

I have written this expression in a chart but I would like to move it to the script as a new field - it doesn't seem to be working. What could the issue be here? 

gilldilpreet_1-1602235594414.png

Many thanks

Dilpreet 

Labels (1)
1 Solution

Accepted Solutions
Chanty4u
MVP
MVP

i think you missed resident in second load

try below,

after where(session_status)='y'  resident  FirstTableName   group by StudentID

View solution in original post

5 Replies
Taoufiq_Zarra

@gilldilpreet  Set analysis is a chart expression not a Script expression

can you share a sample data and the expected output ?

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
MayilVahanan

Hi Gill,

Set analysis syntax not able to use in Script. 

You can try like below. 

Load [Session Date], If([Session Date] = Date(Today(),'DD/MM/YYYY') and Sum_AttendedNumeric >=1, 'Y',
If([Session Date] = Date(Today()-1,'DD/MM/YYYY') and Sum_AttendedNumeric >=1, 'Y', 'N')) as [Attended In Last 2 Days];
Load [Session Date], Sum(AttendedNumeric) as Sum_AttendedNumeric resident Report1
where [Session Status] = 'Y'
group by [Session Date];

 

Note: Based on your screenshot, not able to find the Primary Key. 
So above is the sample script, you can include your required field in the load statement and add those in group by. 

Hope it helps.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Kushal_Chawda

@gilldilpreet  try belo

LOAD *,

       if((floor([Session Date])<= floor(today()) and floor([Session Date])>= floor(today()-4)) and [Session Status]='Y','Y','N') as FLAG

FROM table

gilldilpreet
Contributor III
Contributor III
Author

Hi 

The primary key is Student ID. I tried the below but got an error...

gilldilpreet_0-1602241904872.png

gilldilpreet_1-1602242072497.png

Thanks for your help!

Chanty4u
MVP
MVP

i think you missed resident in second load

try below,

after where(session_status)='y'  resident  FirstTableName   group by StudentID