Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
wgonzalez
Partner - Creator
Partner - Creator

"Script Error": invalid expression

Hi,

Where could the invalid expression be in this script?  I'm receiving the "script error" message while running the script.  The error  "Error: Invalid expression" is shown in the Script Execution Progess dialog box.

 

SUB

Headcount_SummaryHeadCountSumm:

LOAD EmpMonthYear as MonthYear,
BusinessUnit as [Business Unit],
DepartmentNo as [Department No],
DepartmentName as [Department Name],
WorkCenter as [Work Center],
PayGroup as [Pay Group],
sum(EmpRecordCtr) as Headcount,
NetWorkDays(MonthStart(min(MthSrt)),MonthEnd(max(MthEnd))) as
WorkingDays
Resident Employees
Group by EmpMonthYear, BusinessUnit,DepartmentName,WorkCenter,PayGroup;
/* Grouping is made according to EW Organization's hierarchy. */
ENDSUB /* Headcount_Summary */

5 Replies
MayilVahanan

Hi

Please remove the sub and end sub in your script..

And add DepartmentNo,workingDays, MthSrt,MthEnd in group by..

Hope that helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
wgonzalez
Partner - Creator
Partner - Creator
Author

I'm calling the subroutine from another tab.

MayilVahanan

Hi

Did you add

DepartmentNo,workingDays, MthSrt,MthEnd in group by..

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

If you use a group by statement, every field in the LOAD or SELECT must either be in an aggregate expression (like Sum or Max) or in the group by expression. As the previous post states, you have omitted some fields from the group by.

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
bdiamante
Contributor III
Contributor III

I was having the same problem and hadn't seen this mentioned anywhere else. This should be flagged as the the correct answer. Giving a like. Thanks for the help.