-
1
- #1
I am using VFP9 sp2, SQL 2012
I have a form.
1-customer, enters the item number (or can click search and return item item)
2-Call a stored procedure from VFP to sql to Fetch Item record
2.5 - Call another small procedure to get Next/Previous item#
3-values appear on form.
Store Previous Item and Next Item on form property.
2 buttons:
next >
Prvious <
on click of each:
if next button:
If Previous Values
Stored procedure in SQL 2012
Hope this is useful to someone.
Ez Logic
Michigan
I have a form.
1-customer, enters the item number (or can click search and return item item)
2-Call a stored procedure from VFP to sql to Fetch Item record
2.5 - Call another small procedure to get Next/Previous item#
3-values appear on form.
Store Previous Item and Next Item on form property.
2 buttons:
next >
Prvious <
on click of each:
if next button:
Code:
lcNextItem = thisform.cNextItem
if not isnull(lcNextItem) and not empty(lcNextItem)
thisform.txtcItem.value = lcNextItem
thisform.GetValues()
Thisform.GetPreviousNext()
refresh the fields etc..
else
messagebox("Last record reached",48,thisform.caption)
return
endif
If Previous Values
Code:
lPrevItem = thisform.cPreviousItem
if not isnull(lcPrevItem) and not empty(lcPrevItem)
thisform.txtcItem.value = lcPrevItem
thisform.GetValues()
Thisform.GetPreviousNext()
refresh the fields etc..
else
messagebox("First record reached",48,thisform.caption)
return
endif
Stored procedure in SQL 2012
Code:
create procedure GetNextPreviousValuesByItem
@tcItem char(20),
@tnfk_Store int
as
SELECT * FROM (
SELECT
LAG(p.Item) OVER (ORDER BY p.Item) PreviousValue,
p.Item,
LEAD(p.Item) OVER (ORDER BY p.Item) NextValue
FROM ICITEM p
where FK_STORE = @tnfk_Store
and p.Serialized = 1
and p.deleted = 0
) H
where h.item = @tcItem
Hope this is useful to someone.
Ez Logic
Michigan