Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
WestWind/database filter help
Message
De
14/07/2011 10:35:43
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01516279
Message ID:
01518137
Vues:
78
I'm not sure, let me explain what I think is happening...
text to cmd textmerge noshow
exec InTransitRN 
endtext
lr = SQLEXEC( curHandle, cmd, "sq")  && sq is the cursor the data is loaded into
In that code, it's executing the InTransitRN SP and then putting in a cursor called "sq". That SP has filters in it so it only shows one client's data, but it will show all of their data. Then in this code below:
SELECT;	
	client_zip,;
	[<a href="javascript:back('BOL#~X~]+transform(bol_number)+[~]+[') "target="_self"> ]+[</a>            ] as bol_number,;
	ref_num,;
	weight,;
	pro_number,;
	customer_name,;
	customer_state,;
	customer_zip,;
	carrier_name,;
	ship_date,;
	est_delivery,;
	appt_date,;
	latest_status_description,;
	latest_reason_description,;
	date_last_updated;
	FROM sq;
	WHERE bol_Number = ?m.fdBlNo;
	INTO CURSOR TQuery
	SELECT TQuery
	SET CENTURY ON 
	recs=RECCOUNT()
Actually now that I'm typing this out, it seems as if I'm telling it to select fields that the SP is already selecting, is that what's going on? At the same time though, if I remove the above SELECT I lose my table that gets generated through WestWind, which is generated right below the SELECT statement:
loSC = CREATEOBJECT("wwShowCursor")
loSC.lCenterTable = .f.
loSC.cHeaderBGColor = "black"   &&"#336633"
loSC.lAlternateRows = .T.
	loSC.cAlternatingBGColor = "white"  &&"#EFEFEF"
loSC.cTableBorder ="3"
loSC.cTableWidth="1000"
DIMENSION laHeaders[15]
laHeaders[1] = "Ozp"
laHeaders[2] = "BOL#"
laHeaders[3] = "Ref#"
laHeaders[4] = "Weight"
laHeaders[5] = "Pro#"
laHeaders[6] = "Customer Name"
laHeaders[7] = "Dst"
laHeaders[8] = "Dzp"
laHeaders[9] = "Carrier"
laHeaders[10] = "Ship Date"
laHeaders[11] = "Est_Delivery"
laHeaders[12] = "Appt. Date"
laHeaders[13] = "Latest Status"
laHeaders[14] = "Latest Reason"
laHeaders[15] = "Last Updated"
loSC.BuildFieldListHeader(@laHeaders)
loSC.lSumNumerics = .t.
loSC.ShowCursor()
lctable=loSC.GetOutput()
If that's the case then I'm just back where I was, because I don't know how to get the WHERE bol_Number = ?m.fdBlNo; working. It's not like I can put that in the SP itself, and I couldn't get it working any other way. That's the only way I've found that will take the input from the user and only display that record.

>Are you saying you got all data from SQL Server and then filter on the client? And you don't need the rest of the data you fetched?
>
>If so, your approach is wrong as you should have only retrieved the data you need.
>
>>Actually I got it working by adding a WHERE clause in the SELECT statement below the SP call:
>>
>>
SELECT;	
>>	client_zip,;
>>	bol_number,;
>>	ref_num,;
>>	weight,;
>>	pro_number,;
>>	customer_name,;
>>	customer_state,;
>>	customer_zip,;
>>	carrier_name,;
>>	ship_date,;
>>	est_delivery,;
>>	appt_date,;
>>	latest_status_description,;
>>	latest_reason_description,;
>>	date_last_updated;
>>	FROM sq;
>>	WHERE bol_Number = ?m.fdBlNo;
>>	INTO CURSOR TQuery
>>	SELECT TQuery
>>	SET CENTURY ON 
>>	recs=RECCOUNT()
>>
>>That seems to allow me to search for a record number.
>>
>>>I don't understand what exactly is the problem. If you need to retrieve records for particular fdBlNo, then you need to have it as a parameter in your SP and pass it.
>>>
>>>>Alright, but then I'm back another step because it's only displaying every single record instead of one of the record numbers I'm searching for... I'm still trying to get it to take whatever I put in the input box and only display that record. I remember the issue we were having was trying to get this code to work with a stored procedure instead of a SELECT statement:
>>>>
>>>>
	text to cmd textmerge noshow
>>>>*!*	    select top (200) bol_number, pro_number, client_city, client_state, client_zip,
>>>>*!*	     customer_city, customer_state, customer_zip, ship_date
>>>>*!*	    FROM <<TheSQLTable>>
>>>>*!*	    WHERE bol_Number = ?m.fdBlNo
>>>>*!*	endtext
>>>>
>>>>Somehow I need to get the WHERE bol_Number = ?m.fdBlNo working for the SP code below, but didn't figure it out.
>>>>
>>>>
FUNCTION r214input
>>>>
>>>>fdBlNo = ALLTRIM(UPPER(Request.Form("blno")))
>>>>fdBN   = Request.Form("BN")
>>>>fdPK   = Request.Form("PK")
>>>>mEr = ""
>>>>lcTable=""
>>>>m.protbl = ""
>>>>m.rplen = 0
>>>>
>>>>DO CASE
>>>>CASE ! EMPTY(fdBN)
>>>>	SQLWhere = "BN=" + ALLTRIM(fdBN)
>>>>	IF ! EMPTY(fdPK)
>>>>		SQLWhere = SQLWhere + " AND PK=" + ALLTRIM(fdPK)
>>>>	ENDIF 
>>>>OTHERWISE
>>>>	lcTable = "Not Found" 
>>>>	Response.Expandtemplate(goWCServer.oConfig.oTask.cHtmPath+"r214input.htm")
>>>>	RETURN 
>>>>ENDCASE 
>>>>lcTable="TBL Master File<br>"
>>>>
>>>>THESQLDB = "TBL_BL"	
>>>>THESQLTABLE = "TBL_BOL"
>>>>THESERVER = goWCServer.oConfig.oTask.cSQLServer
>>>>usr = ""
>>>>pas = ""
>>>>ConnStr = [driver=SQL Server; server=]+THESERVER+[; database=]+THESQLDB+[; uid=]+usr+[;pwd=]+pas+[; Trusted_Connection=No;]
>>>>curHandle = SQLstringCONNECT( connStr )
>>>>*!*	cmd = [exec InTransit ?']+ALLTRIM(user.cclientcd)+[']
>>>>text to cmd textmerge noshow
>>>>exec InTransitRN 
>>>>endtext
>>>>lr = SQLEXEC( curHandle, cmd, "sq")  && sq is the cursor the data is loaded into
>>>>
>>>>
>>>>IF SQLEXEC( curHandle, cmd, "sq")  = -1
>>>>messagebox(message())
>>>>ENDIF
>>>>
>>>>SELECT;	
>>>>	client_zip,;
>>>>	bol_number,;
>>>>	ref_num,;
>>>>	weight,;
>>>>	pro_number,;
>>>>	customer_name,;
>>>>	customer_state,;
>>>>	customer_zip,;
>>>>	carrier_name,;
>>>>	ship_date,;
>>>>	est_delivery,;
>>>>	appt_date,;
>>>>	latest_status_description,;
>>>>	latest_reason_description,;
>>>>	date_last_updated;
>>>>	FROM sq;
>>>>	INTO CURSOR TQuery
>>>>	SELECT TQuery
>>>>	SET CENTURY ON 
>>>>	recs=RECCOUNT()
>>>>		
>>>>loSC = CREATEOBJECT("wwShowCursor")
>>>>loSC.lCenterTable = .f.
>>>>loSC.cHeaderBGColor = "black"   &&"#336633"
>>>>loSC.lAlternateRows = .T.
>>>>	loSC.cAlternatingBGColor = "white"  &&"#EFEFEF"
>>>>loSC.cTableBorder ="3"
>>>>loSC.cTableWidth="750"
>>>>DIMENSION laHeaders[15]
>>>>laHeaders[1] = "Ozp"
>>>>laHeaders[2] = "BOL#"
>>>>laHeaders[3] = "Ref#"
>>>>laHeaders[4] = "Weight"
>>>>laHeaders[5] = "Pro#"
>>>>laHeaders[6] = "Customer Name"
>>>>laHeaders[7] = "Dst"
>>>>laHeaders[8] = "Dzp"
>>>>laHeaders[9] = "Carrier"
>>>>laHeaders[10] = "Ship Date"
>>>>laHeaders[11] = "Est_Delivery"
>>>>laHeaders[12] = "Appt. Date"
>>>>laHeaders[13] = "Latest Status"
>>>>laHeaders[14] = "Latest Reason"
>>>>laHeaders[15] = "Last Updated"
>>>>loSC.BuildFieldListHeader(@laHeaders)
>>>>loSC.lSumNumerics = .t.
>>>>loSC.ShowCursor()
>>>>lctable=loSC.GetOutput()
>>>>
>>>>Response.ExpandTemplate(goWCServer.oConfig.oTask.cBTSHTMPath+"r214Input.htm")
>>>>ENDFUNC
>>>>
>>>>
>>>>There is my updated function.
>>>>
>>>>>>Here is the line:
>>>>>>
>>>>>>
exec InTransitRN ?m.fdBlNo
>>>>>>
>>>>>>
>>>>>So, here is your problem :)
>>>>>
>>>>>It should be now
>>>>>
>>>>>
exec lnTransitRN
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform