Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

remote View -- Can you pass a variable from the screen that calls the

Status
Not open for further replies.

DHart

Programmer
Oct 29, 2001
11
0
0
US
I want to pass variable from my program to a remote view.

public beg_dte_sql

beg_dte_sql = 37884


OPEN DATABASE l:\pur\dbC\por.dbc SHARED
USE POR!pur_por AGAIN IN 0
SELECT pur_por

The above remote view has the following code. As you can see, I have hard coded a value so that I don't get the whole world.
SELECT Pmppd.PDCO, Pmppd.PDPOID, Pmppd.PDSEQ, Pmppd.PDICDE, Pmppd.PDLDSC,;
Pmppd.PDUOM, Pmppd.PDVND, Pmppd.PDRSTS, Pmppd.PDCPU, Pmppr.PRRSTS,;
Pmppr.PRRCNO, Pmppr.PRHREC, Pmppr.PR8REC, Pmppr.PREREC, Pmppr.PRUOM,;
Pmppr.PRRCQT, Pmppr.PRRCAM, Pmppr.PRPKSL, Pmppr.PRBOLN, Pmppr.PRTRCN,;
Pmppr.PRCARD, Pmppr.PRCO;
FROM {oj PMPPD Pmppd LEFT OUTER JOIN PMDBFA.PMPPR Pmppr ;
ON Pmppd.PDSEQ = Pmppr.PRSEQ };
WHERE Pmppr.PRPOID = Pmppd.PDPOID;
AND (Pmppd.PDCO = ' 2';
AND Pmppr.PRHREC > 37884)

I want to replace the last statement with
Pmppr.PRHREC > beg_dte_sql.

I get an error.
SQL0206 - Column beg_dte_sql not in specified tables.

Is this possible?
 
I assume you want to replace '37884' with a variable for a date.

DATE()-{12/30/1899}=37894

{9/30/2003}-{12/30/1899}=37894

10 days earlier than today= (DATE()-{12/30/1899})-10=37894

thus: (Pmppd.PDCO = ' 2';
AND Pmppr.PRHREC > (DATE()-{12/30/1899})-10)

Brian
 
HI

I want to replace the last statement with
Pmppr.PRHREC > beg_dte_sql.


Pmppr.PRHREC > ?beg_dte_sql

The question mark in the view code will make that as a parameter.

I suggest, you follow some codeing convention, to make the variables more understandable. Normal, I follow..

s= starting e=ending... v=view...
and combine it with field name.

Example..
field name = PRHREC
?vsPrhrec start range variable
?vePrhrec end range varuable...
?vPrhrec single value variable

So in the long run, you wont confuse the variables used in views with the methods/events\prgs variables.

:)



ramani :)
(Subramanian.G)
 
ramani,
Thanks!! Your suggested code change works when I run the view from inside Visual Fox. I changed my code to:
SELECT *
FROM {oj PMPPD Pmppd LEFT OUTER JOIN PMDBFA.PMPPR Pmppr ;
ON Pmppd.PDSEQ = Pmppr.PRSEQ };
WHERE Pmppr.PRPOID = Pmppd.PDPOID;
AND (Pmppd.PDCO = ' 2';
AND Pmppr.PRHREC > ?vprhrec)


HOWEVER..............................................
After I recompile the project, I am getting this error:
Connectivity error: [IBM][Client Access Express ODBC Driver (32-bit)][DB2/400 SQL]SQL0301 - Input host variable *N or argument 1 not valid. Line of code with error: DO l:\pur\payonreceipt.exe

Line number of error: 70 USE POR!pur_por AGAIN IN 0

I have made vprhrec public and given it a value before opening the DBC for this view.

Can you help again?
 
I used to work with a DB2/400.
That message meant the data type did not match.
So "vprhrec" would have to be in DB2/400 format.
Sorry, don't know what that format is.

Andy Rice
San Diego, CA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top