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

filling X column with formula in VBA

Page d'accueil ' Communauté ' Automation et VBA ' Remplissage d'une colonne X avec une formule en VBA

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

    Good morning,

    I am using a formula ( see vb code ) to fill the X column of a signal . The “.FillColumns” line in the code generate an error message “invalid procedure call or argument” .

    It only works If I replace the Step variable directly by a numerical value but I need to use a variable in the formula.
    How can I do ?

    Dim oSignal As DataSet
    Dim Step
    Step = 0.1
    Set oSignal = ActiveDatabase.RootFolder.Add(“Random”, fpObjectTypeDataSet)

    With oSignal
    .DataStructure = fpDataStructureSignal
    .DataType(fpDataComponentX) = fpDataTypeFloat32
    .DataType(fpDataComponentY) = fpDataTypeFloat32
    .NumberOfRows = NbPoints

    .FillColumns “(NumberOfValues(i), FloatingPoint32 1,FloatingPoint32 Step )”, fpDataComponentX

    .Value(fpDataComponentY) = DataY
    End With

    Best regards

    #35065

    Good morning,

    I am using a formula ( see vb code ) to fill the X column of a signal . The “.FillColumns” line in the code generate an error message “invalid procedure call or argument” .

    It only works If I replace the Step variable directly by a numerical value but I need to use a variable in the formula.
    How can I do ?

    Dim oSignal As DataSet
    Dim Step
    Step = 0.1
    Set oSignal = ActiveDatabase.RootFolder.Add(“Random”, fpObjectTypeDataSet)

    With oSignal
    .DataStructure = fpDataStructureSignal
    .DataType(fpDataComponentX) = fpDataTypeFloat32
    .DataType(fpDataComponentY) = fpDataTypeFloat32
    .NumberOfRows = NbPoints

    .FillColumns “(NumberOfValues(i), FloatingPoint32 1,FloatingPoint32 Step )”, fpDataComponentX

    .Value(fpDataComponentY) = DataY
    End With

    Best regards

    #35066
    Bernhard Kantz
    Participant

    The first argument of the [b]FillColumns[/b] method is a FPScript formula which will be evaluated to produce a data series or data matrix to be assigned to the component specified as the second argument. The variable [b]i[/b] is predefined and holds a data series of index values 0, 1, 2, 3 and so on.
    In your code you are using a second variable [b]Step[/b] which is decraded on the VBA level but not for the FPScript function. To solve your problem you may either exchange [b]Step[/b] by the literal constant [b]0.1[/b] or add the following code to the FPScript formula:


    Dim Step
    Step = 0.1
    (NumberOfValues(i), FloatingPoint32 1,FloatingPoint32 Step )

    Hint: If you switch on macro recording and the use the command “Fill column with values” you will see that FlexPro uses an FPScript with delarations as given above.

    support@weisang.com

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