main logo
Subject: Re: Form, Pageframe, Page1 Grid and Total of Col.
Author: Mike Devlin
Posted: 2002/03/06 17:23:57
 
View Entire Thread
New Search


<i><font color="#663300">Hi Mike,

1) It was my fault in not understanding the whole thing. I had created this summed field in my view 8-0. Thus whenever it changed the form went into edited mode. Thanks to your code wherein there was no replace command and that got me thinking, now I have now removed the summed field from the view and just entering the page now does not put the form in edited mode. My new code for your reference:

<code>DODEFAULT()

LOCAL lnSelect

lnSelect = SELECT()

SELECT SUM(yAmount) AS ySum ;
FROM v_sJVDr ;
WHERE iPID = v_tJV.iID ;
GROUP BY iPID ;
INTO CURSOR Temp

THIS.VALUE = Temp.ySum

USE IN Temp

SELECT (lnSelect)</code>

2) I also have the following in the grids amount column valid() method, though the valid fires yet the summed field does not refresh until I save:

<code>DODEFAULT()

THIS.PARENT.PARENT.PARENT.txtYdrtotal.REFRESH()</code>

I have used the object picker for the reference above. Any idea why it doesn't refresh.


3) Now what happens is that as soon as I enter the grid the form goes into edit mode. Click Save then no problem to exit but move around the grid and the form goes into edit mode again. The grid is control sourced by the child view/BO for the form.

This problem is also similar so I will rely on your experience. The child BO/view has a foreign key field iAcctID and the view has 2 fields comming from the accounts master namely cName and cCity. I have a combo in the grid which allows me for selection of the account. The selected accounts cName, cCity and iID from the accounts master are replaced in this child BO. This replacement seems to be triggering the form into edited mode.

What I want to do is to select the account using the combo, save the accounts master iID into the childs iAcctID and the grid to display the cName and cCity from the accounts master. The non current rows in the grid to show their respective accounts master fields. Please help.

Thanks..
</font></i>

1. Cool, glad I could be of help.
2. I have no idea why it would not refresh to the new value. Grids are a weird beast. They seem to use a copy of the cursor they are based on, so changes to the values in the grid and movement in the grid over-ride codeBook pointer movement. Keeping them in sync is a question that was kind of tackled in previous threads. The code I have in my grid text box valid event is this:
LOCAL lnOldArea
DODEFAULT()

lnOldArea = SELECT()
SELECT('v_ee_detl_vp')
REPLACE extension WITH quantity*unit_price IN v_ee_detl_vp
SELECT(lnOldArea)

This.Parent.Parent.Parent.txtExtensionTotal.Refresh()

So, I am not using the column valid, but the text1 valid. I am not sure if this will help or not.

3. I know in the past I have done something like this with a cboLookUp control. The combo is based on a SQL statement, which has all the value I need in it, and saves the values in a named cursor. In your case it would have the iAcctId, cName and cCity in it. Then on the interactive change of the combo, the values in the fields for that record in the combo cursor can be used to replace the values in the cursor that the grid is based on. Or if it is just for display, have two fields in the combo lookup cursor, one field will have the iAcctId, and the other will have the cName +' ' + cCity, and then have only the second field visible.

I hope this helps. There are a bunch of old threads that talk about grids, and how most wise develpoers stay away from using them as data entry controls. =) I am working on my wisdom level.
Devman
mdevlin /AT/ ajdebruin DO.T com

 
©2002 Mike Devlin
<-- Prior Message New Search Next Message -->