Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Struggling With Grids
Message
From
04/08/2000 11:52:48
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Title:
Struggling With Grids
Miscellaneous
Thread ID:
00401129
Message ID:
00401129
Views:
71
The trouble is that no matter what I've tried, I cannot fill the active row in the grid with the item of choice (the active cell has a combo) and its associated data, then make the next row active.

My problem starts with a form for creating Transactions. On it is a grid used to define the subset of inventory items associated with the current transaction ID. Click "Add New Transaction" and the following code is run. The Cursors involved are given 1st for structural purposes.


***********CURSOR INV_NO_TRANS (inventory items not associated with a previous trans) SELECT Inventory.stocknum, Inventory.trans_id, Inventory.item_status,;
Inventory.p_descript,;
LEFT(SUBSTR(Inventory.p_descript,1,AT("$",Inventory.p_descript,2)+8),50) AS memotxt,;
Inventory.is_selected;
FROM tomparco!inventory;
WHERE Inventory.is_selected <> .T.;
ORDER BY Inventory.stocknum
************************************END

******************CURSOR TRANS_ITEMS (Used for other purposes in the form)
SELECT LEFT(SUBSTR(Inventory.p_descript,1,AT("$",Inventory.p_descript,2)+8),50) AS memotxt, Inventory.item_status,;
Inventory.trans_id, Inventory.stocknum, Inventory.p_descript;
FROM tomparco!inventory ;
INTO CURSOR trans_items ;
WHERE Inventory.trans_id = trans_num ;
ORDER BY Inventory.stocknum
************************************End


&& While in "append_mode", the grid's recordsource is a cursor
&& called 'this_trans_items'.


************* Create empty cursor for Items using ‘trans_items’
Thisform.Grid2.RecordSource = “”
USE (DBF('trans_items')) AGAIN IN 0 ALIAS this_trans_items
USE IN trans_items
ZAP IN this_trans_items
APPEND BLANK IN this_trans_items
*************************************End

*********************************** Set Grid Controls ***
Thisform.Grid2.Recordsource = 'this_trans_items'
THISFORM.Grid2.Column1.Sparse = .F.
Thisform.Grid2.Column1.ControlSource = 'this_trans_items.stocknum'
Thisform.Grid2.Column2.ControlSource = this_trans_items.memotxt'
******************************************End

The only field in this cursor that will allow a REPLACE is
&& stocknum. All others come up blank.

I also cannot "thisform.Grid2.Column2.Text1 = trans_items.memotxt". Text1 results in no value. I ran into this same problem last week when trying to retrieve a value from the first row of a grid. In that case: Grid.Column{n).control.value always turned up nothing. I still don't understand why.


********MANIPULATE DATA IN GRID
SELECT inv_no_trans
INDEX ON stocknum TAG stocknum
SEEK This.value ORDER TAG stocknum ASCENDING in inv_no_trans
IF FOUND()
&& I’ve tried Thisform.Grid2.Column2.Text1.value = inv_no_trans.memotxt
&& I’ve tried Thisform.Grid2.Column1.Combo1.value = inv_no_trans.stocknum
REPLACE this_trans_items.memotxt WITH inv_no_trans.memotxt &&WITH Thisform.Grid2.Column2.Text1.value && This fails
REPLACE this_trans_items.stocknum WITH inv_no_trans.stocknum && This succeeds
APPEND BLANK IN this_trans_items && This fails
ENDIF

Again, all I want to do is click on the dropdown arrow in the grid, select an item, its data come up in corresponding columns, activerow (and combo) move to the next line.

I'm searching articles on UT and foxtalk, but haven't found my answer yet, so any help is appreciated.

Thanks
JD
Reply
Map
View

Click here to load this message in the networking platform