2.5 Logical AND

 

Perform logical AND operation at aggregation on a sequence made up of boolean values. One task is to find if all students have access to cell phones in online classes based on the following primary school online teaching terminal survey table.

ID STUDENT_NAME TERMINAL
1 Rebecca Moore Phone
2 Ashley Wilson Phone,PC,Pad
3 Rachel Johnson Phone,PC,Pad
4 Emily Smith Phone,Pad
5 Ashley Smith Phone,PC
6 Matthew Johnson Phone
7 Alexis Smith Phone,PC
8 Megan Wilson Phone,PC,Pad

SPL script:

A
1 =T(“survey.xlsx”)
2 =A1.(TERMINAL.split@c().pos(“Phone”) > 0)
3 =A2.cand()

A1 Load data table.
A2 It is true when a TERMINAL field value contains Phone.
A3 Use cand() function to check if every member of A2’s sequence is true.