-
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
If-Condition with empty variable
- Dieses Thema hat 3 Antworten sowie 2 Teilnehmer und wurde zuletzt vor vor 4 Jahren von Stefan S. aktualisiert.
-
AutorBeiträge
-
Dezember 11, 2020 um 11:53 am Uhr #28527Leon DTeilnehmer
Hey,
I do have measurements with an Measurment number, but some Measurement number do not exist.
For context, I have the following code. In general it works fine.
Dim SourceData = [IC_I_U_RMS, IHV_Sys_ave, MeasNr, Record] Dim maxIHV, maxIC Dim Idx, _Event, _Event2, maxMeasNr, Idx2 Dim Maxima, Idexes, baum Dim startIdx, endIdx maxMeasNr = Maximum(MeasNr.Y) For i = 1 To maxMeasNr Do _Event = ValuesInInterval(MeasNr, i, i, EVENT_INDEX) _Event2 = ValuesInInterval(Record, 1, 1, EVENT_INDEX) Idx = IndexAnd(_Event, _Event2) If Idx = ??? Then maxIHV :="NaN" maxIC :="NaN" Else startIdx = Minimum(Idx) endIdx = Maximum(Idx) maxIHV := Maximum(IHV_Sys_ave[startIdx, endIdx], ) maxIC := Maximum(IC_I_U_RMS[startIdx, endIdx], ) End Maxima = {maxIHV, maxIC} End
My Problem is, that if “IndexAnd()” has no common indexes, it outputs an empty variable. This happens when the MeasNr doesn
t exist. If the MeasNr doesn
t exist the code is supposed to write down “NaN”. So if the variable Idx is empty the code should write “NaN” and if it isn`t empty it should write an value.What i can`t figure out is how to write the “if var Idx equals empty then…” = If Idx = ?EMPTY? Then…
How can i solve this? I can`t put down: False, “”, 0 etc.
Thanks in advance!
Dezember 11, 2020 um 12:24 pm Uhr #28528Stefan S.ModeratorIf the ValuesInterval doesn’t find an event, it returns a data series with zero values. So you can test this with the following code:
If NumberOfRows(Idx) == 0 then
FYI
With the following code you can test if a variable is empty:
If variable == EMPTY then
Dezember 11, 2020 um 2:13 pm Uhr #28529Leon DTeilnehmerIt works great thanks a lot!
Just now i noticed that you can`t write a string into a Dataset, is that correct or am i missing something?
Dezember 11, 2020 um 3:26 pm Uhr #28530Stefan S.ModeratorThis is correct. You cannot use FPScript to change another object (e.g. dataset). Use the result of a new FPScript formula instead of the dataset and work with this (e.g. in a diagram). If you really want to change the original object, you have to use VBA script.
-
AutorBeiträge
- Du musst angemeldet sein, um auf dieses Thema antworten zu können.