Opened 8 years ago

Last modified 8 years ago

#12837 closed defect

Dynamic report variables not parsed correctly — at Version 2

Reported by: anonymous Owned by:
Priority: normal Component: MsSqlBackendPlugin
Severity: normal Keywords: Report SQL Query
Cc: Trac Release: 1.0

Description (last modified by Jun Omae)

I'm attempting to use dynamic variables in one of my reports however when I submit the report the variable is converted into %s

Here's the SQL query i'm attempting to run on the report:

Select * from openquery([redacted_server], '

SELECT
    [UUT_RESULT]
    ,[ORDER_NUMBER]
    ,[STEP_NAME]
    ,[STEP_TYPE]
    ,[STEP_GROUP]
    ,[STEP_INDEX]
    ,[STATUS]
    ,[REPORT_TEXT]
    ,[ERROR_CODE]
    ,[ERROR_MESSAGE]
    ,[CAUSED_SEQFAIL]
    ,[MODULE_TIME]
    ,[TOTAL_TIME]
FROM [teststand].[dbo].[STEP_RESULT]
WHERE [UUT_RESULT] = $UUT_ID')

When attempting to run I'm given the following error:

ProgrammingError: ('42000', "[42000] [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Incorrect syntax near '+'. (102) (SQLExecDirectW); [42000] [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Statement(s) could not be prepared. (8180)")

Which refers to the following:

WHERE [UUT_RESULT] = '+%s+'')

Even if I make a new report and just put $VALUE, it'll come out as %s regardless of what the URL variables are set to. The default dynamic variable of $USER also gets converted to %s.

I'm not too sure how the internals of MsSqlBackendPlugin works but it looks like it's incorrectly being parsed however any insight as to how I can fix this would be very much appreciated.

Change History (2)

comment:1 Changed 8 years ago by anonymous

When I typed 'refers to the following' it seems the text wasn't escaped correctly. What it actually is meant to look like is this:

WHERE [UUT_RESULT] = '+%s+' ' )
Last edited 8 years ago by Jun Omae (previous) (diff)

comment:2 Changed 8 years ago by Jun Omae

Description: modified (diff)
Note: See TracTickets for help on using tickets.