Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I having extremely dificult using IF statement in QS, for me is very diferente that other languages like C,C# or PHP
Im trying this:
If (OID_METER = Peek(OID_METER),
If (Floor(DATE_READ)= Floor(Today()),
(Peek(VALUE_READ)- VALUE_READ) * TYPE_CONSTANT as CONSUMODIA0,
HORA as HORA0
)
If (Floor(DATE_READ)= Floor(Today()-1),
(Peek(VALUE_READ)- VALUE_READ) * TYPE_CONSTANT as CONSUMODIA1,
HORA as HORA1
)
If (Floor(DATE_READ)= Floor(Today()-2),
(Peek(VALUE_READ)- VALUE_READ) * TYPE_CONSTANT as CONSUMODIA2,
HORA as HORA2
)
)
The error is ')' expect, but where? i close all "()"
I mean that you can only have a single AS FIELDNAME at the end of an if statement.
Whilst I am not sure what you are trying to do, I suspect that creating a flag could be part of what you need to do :
If (OID_METER = Peek(OID_METER), 0, 1) as [New Meter Flag] ,
The rest of what you need may be suitable for sorting in the front end. But there again maybe not as I am guessing at your needs.
In the editor if you click your mouse to the right of a ) it will show you the matching ( on the other end.
Yep and i found a match for everyone. I even count 40 bracket. A pair number
In the load script the result of an if statement needs to be assigned to one and only one output field.
You are attempting to assign values to multiple output fields which is invalid.
Didn't understant,
You mean that part where a use "AS CONSUMODIA0" and " AS HORA0", i have to choose between one or other?
I mean that you can only have a single AS FIELDNAME at the end of an if statement.
Whilst I am not sure what you are trying to do, I suspect that creating a flag could be part of what you need to do :
If (OID_METER = Peek(OID_METER), 0, 1) as [New Meter Flag] ,
The rest of what you need may be suitable for sorting in the front end. But there again maybe not as I am guessing at your needs.
You might be missing single quotes in expression.
I wouldn't know where to add but ' may solve the issue
Hi Bill,
Thanks for the help, i trying create 2 fields inside a single if indeed, if my date is today at the same time I add value to field CONSUMODIA0 and a date to HORA field. Pity it can't be done
Yes, i sad that in first coment, but thanks anyway