Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Parameter option "Allow Multiple values" in Command

Hello

I work with CR 2013 and instead of using Select Expert I’m using Command and past into this SQL query:

SELECT "ihRawData_1"."Value", "ihRawData_1"."TimeStamp", "ihRawData_1"."IntervalMilliseconds", "ihTags_1"."Description", "ihRawData_1"."Tagname", "ihRawData_1"."RowCount"

FROM   "ihRawData" "ihRawData_1" INNER JOIN "ihTags" "ihTags_1" ON "ihRawData_1"."Tagname"="ihTags_1"."Tagname"

WHERE "ihRawData_1"."IntervalMilliseconds"={?Interval} AND ("ihRawData_1"."TimeStamp">= '{?Start}' AND "ihRawData_1"."TimeStamp"< '{?End}') AND

("ihRawData_1"."Tagname"='JGLS.PLC7_S2_P_KK2_2_P.F_CV' or 

"ihRawData_1"."Tagname"='JGLS.PLC7_S2_P_KK2_2_1_TO.F_CV') AND "ihRawData_1"."RowCount"=0

ORDER BY "ihTags_1"."Description", "ihRawData_1"."TimeStamp"

and I receive good data.

If I change

("ihRawData_1"."Tagname"='JGLS.PLC7_S2_P_KK2_2_P.F_CV' or 

"ihRawData_1"."Tagname"='JGLS.PLC7_S2_P_KK2_2_1_TO.F_CV'

to

("ihRawData_1"."Tagname" in '{?Tag}')


where Tag is parameter selected as “Allow multiple values”

Then SQL query syntax look like


SELECT "ihRawData_1"."Value", "ihRawData_1"."TimeStamp", "ihRawData_1"."IntervalMilliseconds", "ihTags_1"."Description", "ihRawData_1"."Tagname", "ihRawData_1"."RowCount"

FROM "ihRawData" "ihRawData_1" INNER JOIN "ihTags" "ihTags_1" ON "ihRawData_1"."Tagname"="ihTags_1"."Tagname"

WHERE "ihRawData_1"."IntervalMilliseconds"={?Interval} AND ("ihRawData_1"."TimeStamp">= '{?Start}' AND "ihRawData_1"."TimeStamp"< '{?End}') AND

("ihRawData_1"."Tagname" in '{?Tag}') AND "ihRawData_1"."RowCount"=0

 

ORDER BY "ihTags_1"."Description", "ihRawData_1"."TimeStamp"

After refreshing report and filling next parameters for creating query


javascript:;

I receive all tags from database, not the only two i chosen.


For this problem i have contacted support of Database manufacturer (my data-source) and they have look into dll which is responsible for transferring query from CR to database. Here is their answer:


We are not able to see what the query structure, that is being passed, looks like but engineering has used a debug dll in the past to see what values are being passed.  That was how we determined that you were requesting all of your tags before we fixed your original query.

As an example if I ask for tag JGLS.PLC7_S2_P_KK2_2_P.F_CV we would see entry similar to this in the debug DataArchiver log.

[09/21/15 15:52:02.904] Beginning TagOpenRecordset API call [Worker Thread]

[09/21/15 15:52:02.904] ConfigFile::TagSearch Beginning TagSearch.

[09/21/15 15:52:02.904] ConfigFile::TagSearch TagMask was not a mask [JGLS.PLC7_S2_P_KK2_2_P.F_CV]. Searching directly.

[09/21/15 15:52:02.904] ConfigFile::TagSearch Completed.

[09/21/15 15:52:02.904] Completed API call [Worker Thread] (returning 0)

[09/21/15 15:52:02.904] [Received from [::ffff:3.26.64.116]] [InQueue=0 ms] MessageId=14 RouteId=0 SourceClientId=3 DestClientId=-1 Key=0 [ResponseType-1 ResponseTransNum-14 ResponseThreadId-3212 TagNames-Buffer DataFields-Buffer StartTime-TimeStruct EndTime-TimeStruct SamplingMode-2 Direction-1 NumSamples-0 CalculationMode-1 FilterTag- AllowTagMasks-1 WaitForReply-1 WindowsUsername-Buffer WindowsFullUsername- WindowsDomainAndUsername-\208043969 AuditedWriter-0 IntervalMillisecs-900000 CalcRepEngExtra-0 DataInterval-900000 QueryModifier-0]

[09/21/15 15:52:02.904] HRMasterDataStore::DataOpenRecordset NumTags=[1] FirstTag=[ JGLS.PLC7_S2_P_KK2_2_P.F_CV] Start=[05/15/15 12:45:00.000] End=[05/16/15 13:00:00.000] SamplingMode=[2] CalculationMode=[1] Threadid=[1972]

[09/21/15 15:52:02.904] HRArchiveFile::DataOpenRecordset Start=[05/15/15 12:45:00.000] End=[05/16/15 13:00:00.000] SamplingMode=[2] CalculationMode=[1] ArchiveName=[User_FV_SKL_CNS_Archive007] Threadid=[1972]

But if I attempt to select multiple tags in CR I see something similar to this:

09/21/15 15:27:14.797] Beginning TagOpenRecordset API call [Worker Thread]

[09/21/15 15:27:14.797] ConfigFile::TagSearch Beginning TagSearch.

[09/21/15 15:27:14.797] ConfigFile::TagSearch TagMask was not a mask [ ?ᵻ ].  Searching directly.

[09/21/15 15:27:14.797] ConfigFile::TagSearch Completed.

[09/21/15 15:27:14.797] Completed API call [Worker Thread] (returning 0)

so it appears that CR is sending us the string of ?ᵻ .

What is wrong with this query?

Former Member
Not what you were looking for? View more on this topic or Ask a question