This topic is locked

How to include SecondFieldValue from BETWEEN filter in SQL

8/16/2020 5:01:42 PM
ASPRunner.NET General questions
C
cboucher author

Latest 10.4 newbie here.
I have a report where the SQL executes a stored procedure. Two of the parameters for the stored procedure are FromDateTime and ToDateTime. For the first parameter I pass in ':{filter.FromDateTime}'. I've set the search options on this field to required and only allow BETWEEN. How would I pass in the SecondFieldValue from FromDateTime for the ToDateTime parameter?
Thanks,

Craig

FrankR_ENTA 8/16/2020



Latest 10.4 newbie here.
I have a report where the SQL executes a stored procedure. Two of the parameters for the stored procedure are FromDateTime and ToDateTime. For the first parameter I pass in ':{filter.FromDateTime}'. I've set the search options on this field to required and only allow BETWEEN. How would I pass in the SecondFieldValue from FromDateTime for the ToDateTime parameter?
Thanks,

Craig


I think you can accomplish by -

  • Doing a >= and <= for the dates inside the where clause inside the stored proc
  • Code two different parameters and set them in Search simply as EQUALS.
    I think this will work.

C
cboucher author 8/16/2020

Thanks Frank.
That's what I'm doing now. But I like the layout of the BETWEEN search parameter and it would be nice to stay consistent with my other lists that contain date range parameters.
Thanks,

Craig

admin 8/18/2020
C
cboucher author 8/18/2020

How do I get an instance of the SeachObject in the List event of the report?
I clicked on the Generate C# Code button in the Source tab of the report. Below are the first two lines of code I added to this event.

var srchObj = SearchClause.getSearchObject(table);

var fromDateTimeSecondValue = srchObj.getSecondFieldValue("FromDateTimeParam");


I get the following error when I build.

include\worksessiondetailreport_TableEvents.cs(23,44): error CS0103: The name 'table' does not exist in the current context [D:\Users\craig\Documents\ASPRunnerNETProjects\PieceCounter\output\PieceCounterEventsCS.csproj]

include\worksessiondetailreport_TableEvents.cs(24,39): error CS1061: 'runnerDotNet.XVar' does not contain a definition for 'getSecondFieldValue' and no extension method 'getSecondFieldValue' accepting a first argument of type 'runnerDotNet.XVar' could be found (are you missing a using directive or an assembly reference?) [D:\Users\craig\Documents\ASPRunnerNETProjects\PieceCounter\output\PieceCounterEventsCS.csproj]


I seem to be doing something wrong.
Thanks,

Craig