Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

wgonzalez
Contributor

"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 */

Tags (2)
5 Replies

Re: "Script Error": invalid expression

Hi

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

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

Hope that helps

wgonzalez
Contributor

Re: "Script Error": invalid expression

I'm calling the subroutine from another tab.

Re: "Script Error": invalid expression

Hi

Did you add

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

MVP
MVP

Re: "Script Error": invalid expression

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
New Contributor III

Re: "Script Error": invalid expression

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.