-
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
Apply function to a data folder
Home > Community > Automation and VBA > Apply function to a data folder
- Dieses Thema hat 4 Antworten sowie 2 Teilnehmer und wurde zuletzt vor vor 9 Jahren, 3 Monaten von HerveM1234 aktualisiert.
-
AutorBeiträge
-
Juli 24, 2015 um 3:20 pm Uhr #12880HerveM1234Teilnehmer
Hi,
I would like to applie a FPS function to every dataset contained in a folder in order to create automaticly a formula for each signal.
For example, if I have a folder containing 3 signals Va, Vb & Vc, I would like to applie the predifined function RMS_func and create 3 formulas Va_RMS, Vb_RMS, Vc_RMS.I’ve read the help file but I’m not able to do that in VBA.
Thanks for you help
Juli 24, 2015 um 3:20 pm Uhr #8540HerveM1234TeilnehmerHi,
I would like to applie a FPS function to every dataset contained in a folder in order to create automaticly a formula for each signal.
For example, if I have a folder containing 3 signals Va, Vb & Vc, I would like to applie the predifined function RMS_func and create 3 formulas Va_RMS, Vb_RMS, Vc_RMS.I’ve read the help file but I’m not able to do that in VBA.
Thanks for you help
Juli 27, 2015 um 9:08 am Uhr #9389Bernhard KantzTeilnehmerThere 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
Juli 27, 2015 um 6:01 pm Uhr #9390HerveM1234TeilnehmerHi again,
is it possible to proceed if the folder is containning indifferently Formulas and/or Datasets?
Juli 28, 2015 um 8:59 am Uhr #9391Bernhard KantzTeilnehmerIf you want to apply your function to only a subset of datasets present in the active folder, you can replace the argument of the folders Objects() property. E.g. your datasets all have names of a specific pattern (like 2014_11_xx_07_yy denoting a measurement from a november day starting a 7 o’clock) you may use a regular expression (“^2014_11_\d{2}_07_\d{2}\.DAT$”) to filter out the desired selection.
More on regular expressions can be found in the Online Help in the chapter Automating Processes > Automation Using FlexPro Visual Basic > FlexPro Visual Basic Reference > Objects and Collections > F > Folder > Properties > Objects.
-
AutorBeiträge
- Du musst angemeldet sein, um auf dieses Thema antworten zu können.