Hi,
This script works well when I tested with value but when I transfered to form Button script, some reason it did not work and the query.filter not able to recognize the "vManufId". My Ui_msg_box displayed as " Manuf_id="" " .
Button Script -- Every line is same as Test Scripts except the vSeriesId. I added as
What is wrong with the current vSeriesId and vManufId?
This script works well when I tested with value but when I transfered to form Button script, some reason it did not work and the query.filter not able to recognize the "vManufId". My Ui_msg_box displayed as " Manuf_id="" " .
Code:
[COLOR="Red"]'Test dim vSeriesId as c vSeriesId ="dl002"[/COLOR] 'vSeriesId = parentform:Series_id.value 'Find and get the Manuf_id from Series table dim tSeries as p dim qSeries as p dim rSeries as n dim vSeriesId as c tSeries = table.open("series",FILE_RO_SHARED) query.order="Series_id" query.filter="Series_id="+quote(vSeriesId) qSeries = tSeries.query_create() rSeries = qSeries.records_get() if rSeries>0 then vManufId = alltrim(tSeries.Manuf_id) ui_msg_box("Test","Current Series is "+vSeriesId+" "+vManufId) 'Find the vendors from Manuf_dealer table dim tDealer as p dim qDealer as p dim rDealer as n dim vVndrId as c dim vVndrNm as c dim vManufId as c tDealer = table.open("manuf_dealer",FILE_RO_SHARED) query.order="" [COLOR="red"]query.filter ="Manuf_id="+quote(vManufId)[/COLOR] qDealer = tDealer.query_create() rDealer = qDealer.records_get() if rDealer>0 then tDealer.fetch_first() while .not. tDealer.fetch_eof() vVndrId=alltrim(tDealer.Vendor_id) vVndrNm = alltrim(tDealer.Dealer_name) ui_msg_box("Dealer","Found the dealer "+vVndrNm+" "+vVndrId) 'Auto added the Dealer into PrdctVndrs table tDealer.fetch_next() end while else [COLOR="Blue"]ui_msg_box("Error","Not able to find by "query.filter)[/COLOR] end if qDealer.drop() tDealer.close() end if qSeries.drop() tSeries.close() end
Code:
dim vSeriesId as c vSeriesId = parentform:Series_id.value
Comment