Home Forum Blog Market Events Resources
Showing results for 
Search instead for 
Do you mean 
Highlighted
New Contributor
Posts: 3
Registered: ‎11-15-2017
Accepted Solution

List View

[ Edited ]

Hi guys

I have a procedure that return start date and end date as follows:

 

create procedure [GetWeekdays](
@Date Date
)
As

As
Declare @Fri datetime, @Mon datetime

set @Fri=(SELECT DATEADD(d, 6- DATEPART(dw, @Date), @Date))
set @Mon= (SELECT DATEADD(wk, DATEDIFF(wk,0,@Date), 0) MondayOfCurrentWeek)

DECLARE @StartDate DATE = @Mon, @EndDate DATE = @Fri

SELECT date FROM ( SELECT DATE = DATEADD(DAY, rn - 1, @StartDate) FROM (
SELECT TOP (DATEDIFF(DAY, @StartDate, DATEADD(DAY,1,@EndDate)))
rn = ROW_NUMBER() OVER (ORDER BY s1.[object_id])
FROM sys.all_objects AS s1
CROSS JOIN sys.all_objects AS s2
ORDER BY s1.[object_id] ) AS x ) AS y

 

 

inputed: 2017/12/04

Results:
2017/12/04
2017/12/05
2017/12/06
2017/12/07
2017/12/08

 

How can I implement this procedure in such a way that when I press the Button from a Itemview a subview  show up with this results.

 

TIA.

 

Frequent Contributor
Posts: 126
Registered: ‎12-14-2016

Re: List View

[ Edited ]

Hi Zandi,

 

Please follow below steps

 

Step1: Execute the script in Sql Server.

 

Step2: Open Smartobject tester utility and under ServiceObject  look for  SQL Server Service  and then expand this node.

 

Step3: Select your database and refresh it. If not available right click  on  SQL Server Service and select register service instance,

here provide the Database details under service keys and  click next  to proceed further to complete this step.

 

Step4: Now create a smartobject (this you can do any of  the two ways)
1) Create smartobject using SMO tester utility.

2) Using SMO designer create Smartobject for this procedure.

 

Step 5: Once Smartobject is created proceed for view creation

here you need to create two views one will show dates as subview (appears on screen when button click) and second will be your view with button.

view 1:

  • Create a view let it name "View.ShowDates" of type listview. (remember to select checkbox for "Call this method when the form loads")
  • Goto rules and edit rule "When the View executed Initialize"
  • Click on configuration for action "then execute the List method (configure)"
  • Under Input mapping details pass some vaild date for Date parameter
  • Click on finsih and save this view.

view 2: 

  • Create another view let name it "View.GetDetails"
  • Add an button in view and under properties click on "Rules tab".
  • Now add an action "Open a subview".
  • click on "select view" (green color text ) and select view "View.ShowDates" created above.
  • click finish and then save this view.

 

Let me know if this helps you.




Karan Verma
India

Blog:k2recipes
New Contributor
Posts: 3
Registered: ‎11-15-2017

Re: List View

The solution worked perfectly. 

Thank you.