Error in code generation

This public forum is for user-to-user discussions of ASP Report Maker. Note that this is not support forum.

Error in code generation

Postby yeehoy » Mon Dec 19, 2016 7:54 am

I had a project in ASPRM 8 which works fine. Loaded that to ASPRM 9 and got the error below:

Microsoft VBScript compilation error '800a0401'
Expected end of statement
/eComp2/Job_Descriptionsmry.asp, line 171
tblfilter = "[SessionID]='" & CurrentUserName() & "'";
-----------------------------------------------------^

Had a look at the generated Job_Descriptionsmry.asp and it shows the following:

Job_Description.JobDescriptionFor.LookupSql = "SELECT DISTINCT [JobDescriptionFor], [JobDescriptionFor] AS [DispFld] FROM [dbo].[qryJobDescWork]"
sWhereWrk = ""
tblfilter = "[SessionID]='" & CurrentUserName() & "'"; <---- Line 171 has the semicolon at the end
If tblfilter&"" <> "" Then
ewr_AddFilter(sWhereWrk, tblfilter); <--------- This line also has the semicolon and when compared to the code generated by ASPRM 8, it didn't have the "Call..." in front.
End If
Call ewr_AddFilter(sWhereWrk, UserIDFilter)

Is this a bug in the template? I've tried deleting template cache and regen but stil getting the same error.

Thanks...
yeehoy
 
Posts: 96
Joined: Wed Nov 21, 2012 11:14 am

Re: Error in code generation

Postby motfs » Mon Dec 19, 2016 11:04 am

I have the same issue before and got the solution from support regard to this issue.

Add the following code to usercode.js (under C:\Program Files (x86)\ASP Report Maker 9\src) to modify the code:

SYSTEMFUNCTIONS.LookupSql.replace('tblfilter = "<tablefilter>";', 'tblfilter = "<tablefilter>"');
SYSTEMFUNCTIONS.LookupSql.replace('ewr_AddFilter(sWhereWrk, tblfilter);', 'Call ewr_AddFilter(sWhereWrk, tblfilter)');
motfs
 
Posts: 710
Joined: Tue Sep 08, 2015 4:55 pm

Re: Error in code generation

Postby yeehoy » Mon Dec 19, 2016 12:04 pm

Thanks

Don't know why but it seems to work for the line

Call ewr_AddFilter(sWhereWrk, tblfilter)

but not the line

tblfilter = "[SessionID]='" & CurrentUserName() & "'"; <<<<<< semi-colon still there. I've even tried to change the filter condition to just "1=1" to test. Same problem.
yeehoy
 
Posts: 96
Joined: Wed Nov 21, 2012 11:14 am

Re: Error in code generation

Postby motfs » Tue Dec 20, 2016 4:46 pm

> SYSTEMFUNCTIONS.LookupSql.replace('tblfilter = "<tablefilter>";', 'tblfilter = "<tablefilter>"');

<tablefilter> is the actual table filter. So, in your case, it is 1=1 if you put 1=1.
motfs
 
Posts: 710
Joined: Tue Sep 08, 2015 4:55 pm


Return to General Discussion (ASP Report Maker)