Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is there a Grid or column listcount()
Message
De
23/07/2001 18:08:10
Nancy Folsom
Pixel Dust Industries
Washington, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00534130
Message ID:
00534140
Vues:
12
This message has been marked as a message which has helped to the initial question of the thread.
>I have a grid with 2 columns that change values depending on what options the end-user has chosen. What I need to be able to do is grab all of the values listed in the first column, and stuff them into a string (X,Y,Z) or an array for later use. Here is the code I have:

Do you mean you need to save the value in the first column for each row in the grid's cursor--"grab all of the values listed in the first column?"

If so then it would be something like below:

>
>WITH ThisForm.cUtility.grdBoms.cGridList.Column1
>
> FOR lnCount = 1 TO .ControlCount

Why are you iterating through the controls in the column? You seem to only be dealing with the single default textbox (text1).

>
> lcAffectedBom = ALLTRIM(eval(.text1.ControlSource))


This is wasteful to do a FOR if you are going to have a data set of any size. Better to do something like

LOCAL lcField
lcField = (.text1.ControlSource)
...
SELECT MyGridsRecordSource
SCAN
lcAffectedBom = ALLTRIM(eval(lcField)) && Try to minimize object resolution
ENDSCAN

etc.
>
> IF ISBLANK(vp_cAffectedBoms) OR ISNULL(vp_cAffectedBoms)
> vp_cAffectedBoms = lcAffectedBom
> ELSE
> vp_cAffectedBoms = (vp_cAffectedBoms + "," + lcAffectedBom)
> ENDIF
> ENDFOR
>ENDWITH

>
>I tested this with a grid that had 5 different values in it - when it was done executing, lnCount was 3 instead of 5

.ControlCount is the number of objects in the column. A column has a header and textbox by default. Sounds like there's another control in your column? It is not the number of rows in the recordsource, which is what it seems like you want.

> and vp_cAffectedBoms was "Value1,Value1" instead of "Value1,Value2,Value3,Value4,Value5" as expected.
>
>Is there any way to first accurately count the number of objects/fields/rows in the first column, and grab and store each value?

Objects, Fields, Rows. All different things. I assume you mean row.

RECCOUNT will tell you records in a cursor. If you've done a SELECT, you'd be able to use TALLY.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform