Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
View parameters request at validation
Message
 
 
À
02/10/2001 13:13:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Stonefield
Divers
Thread ID:
00563149
Message ID:
00563271
Vues:
17
>I would appreciate any hints to make the Stonefield database explorer not to ask for each and every view parameter when opening (validation) a database.
>
>Regards and thanks in advance
>
>Oscar Corte

If you set the ParameterList property for all your views, the following code will create all the variables for you:
IF EMPTY(SET("Database"))
   RETURN .f.
ENDIF
LOCAL lnRetVal, laViews[1], lcView, lcParmString
lnRetVal = ADBOBJECTS(laViews,"VIEW")
FOR EACH lcView IN laViews
   lcParmString = DBGetProp(lcView, 'View', 'ParameterList')
   CreateParms(lcParmString)
ENDFOR
RETURN

PROCEDURE CreateParms
*
LPARAMETERS tcString
IF VARTYPE(tcString) <> "C" OR empty(tcString)
   RETURN
ENDIF
tcString = ALLTRIM(tcString)
LOCAL lnKount, lcVarName, lcVarType
lnKount = 0
DO WHILE LEN(tcString) > 0
   lcVarName = SUBSTR(tcString, 1, AT(',', tcString) - 1)
   lcVarType = SUBSTR(tcString, AT(',', tcString) + 1)
   IF AT(';', lcVarType) > 0
      lcVarType = SUBSTR(lcVarType, 1, AT(';', lcVarType) - 1)
   ENDIF
   lcVarType = CHRTRAN(lcVarType, "'", "")
   PUBLIC &lcVarName
   DO case
      CASE INLIST(lcVarType, "N", "I", "Y")
         &lcVarName = 0
      CASE lcVarType = "C"
         &lcVarName = ""
      CASE lcVarType = "D"
         &lcVarName = {}
      CASE lcVarType = "T"
         &lcVarName = DTOT({})
   ENDCASE
   IF AT(';', tcString) = 0
      tcString = ''
   ELSE
      tcString = SUBSTR(tcString, AT(';', tcString) + 1)
   ENDIF
ENDDO
RETURN
You will only have a problem if two or more views use the same parameter name but are of different data types.
Mark McCasland
Midlothian, TX USA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform