FlexPro
HistoryBase
Ingénierie
Formation
Téléchargements
Support FlexPro
Connaissance
Communauté
À propos de nous
Références
Emplois
Contact général
Liste des revendeurs
Support FlexPro
FR
DE
EN
Porte-plaquette
Produits et solutions
Support et téléchargements
Entreprise
Magazine
Contact
Langue
MyWeisang

Paramètres du compte.

Topic

Accessing to calculated datas in VBA

Page d'accueil ' Communauté ' Automation et VBA ' Accès aux données calculées en VBA

Voir les messages de 3 - 1 à 3 (sur un total de 3)
  • Auteur
    Messages
  • #35210
    HerveM1234
    Participant

    Hi,

    What is the best way to access from VBA to datas calculated (or not) in FlexProScript.

    I tried :[code]Dim toto1, toto2, toto3
    Set toto1 = ActiveDatabase.RootFolder.Object(“Formulasmyformula.FML”, fpObjectTypeFormula).Value
    Set toto2 = toto1.X
    toto3=toto2(0) ‘ acces to the first xvalue of myformula for example[/code]
    It seems to work fine

    If I write
    [code]dim toto
    toto=ActiveDatabase.RootFolder.Object(“Formulasmyformula.FML”, fpObjectTypeFormula).Value.X(0)
    [/code] it doesn’t work. Why?

    This this code does not work either :
    [code]
    dim toto
    set toto = databases(“MyDatabase.FPD”).Object(“Formulasmyformula.FML”).value
    [/code] Something wrong?

    Thank you for the help

    #35212
    HerveM1234
    Participant

    Hi,

    What is the best way to access from VBA to datas calculated (or not) in FlexProScript.

    I tried :[code]Dim toto1, toto2, toto3
    Set toto1 = ActiveDatabase.RootFolder.Object(“Formulasmyformula.FML”, fpObjectTypeFormula).Value
    Set toto2 = toto1.X
    toto3=toto2(0) ‘ acces to the first xvalue of myformula for example[/code]
    It seems to work fine

    If I write
    [code]dim toto
    toto=ActiveDatabase.RootFolder.Object(“Formulasmyformula.FML”, fpObjectTypeFormula).Value.X(0)
    [/code] it doesn’t work. Why?

    This this code does not work either :
    [code]
    dim toto
    set toto = databases(“MyDatabase.FPD”).Object(“Formulasmyformula.FML”).value
    [/code] Something wrong?

    Thank you for the help

    #35211
    Bernhard Kantz
    Participant

    The first example won’t work since “value.X” does not exist for a FlexPro formula object. Instead, you have to use e.g.

    [code]
    Dim toto
    toto = ActiveDatabase.RootFolder.Object(“Formula”, fpObjectTypeFormula).Value(fpDataComponentX)(0)
    [/code]
    Moreover, it is suggested to use early binding, e.g.:

    [code]
    Dim fml as Formula
    fml = ActiveDatabase.RootFolder.Object(“Formula”, fpObjectTypeFormula)

    Dim result as double
    result = fml.Value(fpDataComponentX)(0)
    [/code]
    Finally, in the last example you should open the desired database first and should again use early binding. More details about the value property can e.g. be found in the FlexPro Online-Help under Automating Processes | Automation Using FlexPro Visual Basic.

Voir les messages de 3 - 1 à 3 (sur un total de 3)
  • Vous devez être connecté pour répondre à ce sujet.