Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Y/N fields displayed in checkboxes in grid
Message
 
 
À
05/03/2007 12:11:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01200782
Message ID:
01200784
Vues:
26
Hi Terry,

I would probably create a local view for the grid's RecordSource and update table field with .t./.f. depending on extra field Y/N in the view.

>Hello Chaps
>
>This continuing problem I have of FPD2.6 tables (from a legacy, still used system) that I'm using in my replacement for the old system. For some reason, the author made Y/N char fields rather than logical. I want to display certain child recs in a grid, and allow edit thereof.
>
>I populate the grid in the following manner:
>
>With Thisform
>  lcAlias	  = ALIAS()
>  Select JNYSTAGE
>  lcFilter = "OPERATOR = " + STR( .nOperator, 3, 0) + ;
>  	    " and ROUTE = '" + .cRoute + "'" + ;
>  	    " and MCL_RTE = '" + .cMCL_Rte + "'"
>  Set Filter To &lcFilter
>  Locate
>  With .pgfMainPageFrame.Page3
>    With .grdJnyStage
>      .Column1.chkCheck1.Value = IIF( JOURNEY	= "Y", .T., .F.)
>      .Column4.chkCheck1.Value = IIF( STAGE 	= "Y", .T., .F.)
>      .Column7.chkCheck1.Value = IIF( MON	= "Y", .T., .F.)
>             ...	        tue, wed, thu, etc.
>...
>
>
>and, after edit, HOPE to save it as follows:
>
>
>If sysCONFIRM(	"Save changes to Journey Stages Table?", ;
>		"Confirm Save Changes")
>    Select JNYSTAGE
>    Locate
>    If not RLOCK()
>	= sysWARNINGMESSAGE( "Sorry.  Unable to update the Journey Stages Table." + CHR(13) + ;
>			   "Another User has the table open for edit.", ;
>			   "Cannot Update Journey Stages")
>    Else
>	With this.Parent
>           With .grdJnyStage
>	    Replace JOURNEY with IIF( .Column1.chkCheck1.Value,	 "Y", "N")
>	    Replace STAGE   with IIF( .Column4.chkCheck1.Value,	 "Y", "N")
>	    Replace MON     with IIF( .Column7.chkCheck1.Value,	 "Y", "N")
>             ...	        tue, wed, thu, etc.
>             .Refresh()
>	  EndWith
>	  = TABLEUPDATE( .T.)
>	  UNLOCK
>    EndIf
>EndIf
>
>
>Trouble is: All recs in the grid get saved in the same permutation of checks as the 1st record and don't necessarily follow the underllying data. I've tried putting the Replaces in a scan-endscan, but what happened then was the children of the parent rec 3 got copied to those of parent rec 5, and removed from those of parent rec 3, and then only the top rec (out of 2 in this case).
>
>Now then, to predict the obvious questions:
>
>Each "checkbox" column has no .ControlSource (that just gives a data type m-m error anyway) and is not .Bound
>
>I'm probably missing something simple here (I'm not sure I've ever had to do this) - What can it be?
>
>'ppreciate it
>
>Terry
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform