-
FlexPro
- Auf einen Blick
- Features & Optionen
- Einsatzgebiete
- Alle Vorteile
- Neu in FlexPro 2021
- FlexPro gratis testen
- FlexPro View OEM Freeware
- Kaufberatung
- Login
- Language
- +49 6894 929600
- infoweisang.com
- Google Maps
- Produkte
- News
- Support
- Unternehmen
- Jobs
- Kontakt
- Login
- Language
- +49 6894 929600
- infoweisang.com
- Google Maps
Home > Community > Automation and VBA > Apply function to a data folder > Antwort auf: Apply function to a data folder
Juli 27, 2015 um 9:08 am Uhr
#9389
Bernhard Kantz
Teilnehmer
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