-
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
If-Condition with empty variable
- This topic has 3 replies, 2 voices, and was last updated 4 years ago by Stefan S..
-
AuthorPosts
-
December 11, 2020 at 11:53 am #28527Leon DParticipant
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!
December 11, 2020 at 12:24 pm #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
December 11, 2020 at 2:13 pm #28529Leon DParticipantIt 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?
December 11, 2020 at 3:26 pm #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.
-
AuthorPosts
- You must be logged in to reply to this topic.