-
FlexPro
- Zoom sur FlexPro
- Fonctionnalités & Options
- Domaines d’application
- Tous les avantages
- Nouveau dans FlexPro 2021
- Testez FlexPro gratuitement
- FlexPro View OEM Freeware
- Conseils d’achat
- Login
- Langue
- +49 6894 929600
- infoweisang.com
- Google Maps
- Produits
- News
- Support
- Société
- Emplois
- Contact
- Login
- Langue
- +49 6894 929600
- infoweisang.com
- Google Maps
Accueil > Community > Automation and VBA > Apply function to a data folder > Reply To: Apply function to a data folder
July 27, 2015 at 9:08 am
#9389
Bernhard Kantz
Participant
There is a manual way to achieve this. Place your function formula (starting with Arguments … and named e.g. _RMS) in the folder and drag the signals onto that formula. This creates for each signal a new formula containing the application of the function on the signal.
Using Automation this small code sample performs the same task:
Option Explicit
Const FunctionPath As String = "\RMS_func"
Const FunctionPrefix As String = "_RMS"
Public Sub ApplyFunction()
Dim fldSignals As Folder
Set fldSignals = ActiveDatabase.ActiveFolder
Dim cllSignals As FpObjects
Set cllSignals = fldSignals.Objects(fpObjectTypeDataSet)
Dim dsSignal As DataSet
Dim fmlApplSignal As Formula
For Each dsSignal In cllSignals
Set fmlApplSignal = fldSignals.Add(dsSignal.Name & FunctionPrefix, fpObjectTypeFormula)
With fmlApplSignal
.Author = "Macro ApplyFunction()"
.Formula = FunctionPath & "(" & dsSignal.Name & ")" & vbCrLf
.ReadOnly = True
End With
Next
End Sub