This returns all the first 'nd's as expected
select="osm/way/nd[1]"
This returns all the lasts:
select="osm/way/nd[last()]"
This returns both:
select="osm/way/nd[position() = 1 or position() = last()]"
Is there a syntax to remove position() function?
Something like this, but works?
select="osm/way/nd[[1] or [last()]]"
There has been some debate about allowing a new syntax to select a range https://github.com/qt4cg/qtspecs/issues/50#issuecomment-799228627 e.g. osm/way/nd[#1,last()] might work in a future XPath 4 but currently it is all up in the air of a lot of debate and questionable whether a new operator is helpful instead of doing osm/way/nd[position() = (1, last())].
How can I format a Twig Calculation?
Currently I am using the following Code:
£{{ (Results.Result._symbol_at_attributes.adults +
Results.Result._symbol_at_attributes.children) *
Results.Result._symbol_at_attributes.price / 100 * 95 }}
Current Example Output: £459.4
Needed Output: £459
You can use the builtin filter number_format.
£{{ ((Results.Result._symbol_at_attributes.adults + Results.Result._symbol_at_attributes.children) * Results.Result._symbol_at_attributes.price / 100 * 95) | number_format }}
Do note: you have to add parantheses around the calculation, otherwise the filter would only be applied to the last part of the calculation due to the precedence of operators
The excel not accepting the formula
=IF(AND(Sheet1!BZ2<>"",Sheet1!CB2<>"",Sheet1!CD2<>"",Sheet1!CF2<>"",Sheet1!CH2<>"",Sheet1!CA2="",Sheet1!BC2="B"), IF(Sheet1!CA2="","",TODAY()-1),
IF(
IF(AND(Sheet1!BZ2<>"",Sheet1!CA2="",Sheet1!BC2="A"),IF(Sheet1!CA2="","",TODAY()-1),
IF(
IF(AND(OR(Sheet1!DB2="Completed - Knowledge Transfer"),AND(Sheet1!BC2<>"")),IF(Sheet1!CA2="","",TODAY()-1),
IF(Sheet1!CA2="","",Sheet1!CA2)
)
)
)
I am following the below syntax for IF .
=IF (logical_test, [value_if_true], [value_if_false])
I am trying to nest the other conditions whenever the statements gets FALSE
Please help.
Can someone pls find the syntax error I am doing in this
The If statement isn't nested properly and also you are using some AND Or statements which are again not used properly.
Simplifying your formula we get this
=IF(a,b,IF(IF(c,d,IF(IF(e,f,g)))
where ,
a = AND(Sheet1!BZ2<>"",Sheet1!CB2<>"",Sheet1!CD2<>"",Sheet1!CF2<>"",Sheet1!CH2<>"",Sheet1!CA2="",Sheet1!BC2="B")
b = IF(Sheet1!CA2="","",TODAY()-1)
c = AND(Sheet1!BZ2<>"",Sheet1!CA2="",Sheet1!BC2="A")
d = IF(Sheet1!CA2="","",TODAY()-1)
e = AND(OR(Sheet1!DB2="Completed - Knowledge Transfer"),AND(Sheet1!BC2<>""))This does not make sense
f = IF(Sheet1!CA2="","",TODAY()-1)
g = IF(Sheet1!CA2="","",Sheet1!CA2)
A proper nested IF will be of the form
=IF(a,b,IF(c,d,IF(e,f,g)))
Your formula can also be written as:
=IF(Sheet1!CA2="","",
IF(OR(
AND(Sheet1!BZ2<>"",Sheet1!CB2<>"",Sheet1!CD2<>"",Sheet1!CF2<>"",Sheet1!CH2<>"",Sheet1!BC2="B"),
AND(Sheet1!BZ2<>"",Sheet1!BC2="A"),
AND(Sheet1!DB2="Completed - Knowledge Transfer",Sheet1!BC2<>"")),
TODAY()-1,Sheet1!CA2))
The Syntax is a nested syntax (assuming a1 = 12 and b2=15:)
=IF(A1<13,IF(B1>13,"B1","Not Found"),"Not Found")
You overused IF() formula. I tried to simplify your formula, check this:
=IF(AND(Sheet1!BZ2<>"",Sheet1!CB2<>"",Sheet1!CD2<>"",Sheet1!CF2<>"",Sheet1!CH2<>"",Sheet1!CA2="",Sheet1!BC2="B"),IF(Sheet1!CA2="","",TODAY()-1),IF(AND(Sheet1!BZ2<>"",Sheet1!CA2="",Sheet1!BC2="A"),IF(Sheet1!CA2="","",TODAY()-1),IF(OR(Sheet1!DB2="Completed - Knowledge Transfer",Sheet1!BC2<>""),IF(Sheet1!CA2="","",TODAY()-1),IF(Sheet1!CA2="","",TODAY()-1))))
Nested view of formula above:
=IF(AND(Sheet1!BZ2<>"",Sheet1!CB2<>"",Sheet1!CD2<>"",Sheet1!CF2<>"",Sheet1!CH2<>"",Sheet1!CA2="",Sheet1!BC2="B"),
IF(Sheet1!CA2="","",TODAY()-1),IF(AND(Sheet1!BZ2<>"",Sheet1!CA2="",Sheet1!BC2="A"),
IF(Sheet1!CA2="","",TODAY()-1),
IF(OR(Sheet1!DB2="Completed - Knowledge Transfer",Sheet1!BC2<>""),
IF(Sheet1!CA2="","",TODAY()-1),
IF(Sheet1!CA2="","",TODAY()-1)
)
)
)
I am curious as how I can solve this.
I have a column containing product name(columns AQ) and I have created a column to its right showing(column AR) 1 or 0 if it matches.
this is the code :=IF(RIGHT(AQ3;3)="MAX";1;0)
What I wanted to know is... how can I use the AND or OR function to add "BAS"( so it has both "MAX" and "BAS") in the above code?
I tried this but it returned #VALUE.
Failed attempt.IF(RIGHT(AQ3;3)="MAX";1;0);IF(RIGHT(AQ3;3)="BAS";1;0)
Thanks for the answers: How to I use "AND" in this?
You use it as follows:
=IF(OR(RIGHT(AQ3;3)="MAX";RIGHT(AQ3;3)="BAS");1;0)
OR works like that: OR( Expr1 ; Expr2 ; Expr3? ...)
If any of those expressions evaluate to TRUE, then OR returns true.
Your IF syntax will work like this:
=IF(RIGHT(AQ3;3)="MAX";1;IF(RIGHT(AQ3;3)="BAS";1;0))
or an alternative OR version:
=IF(OR(RIGHT(AQ3;3)={"MAX";"BAS"});1;0)
I have Excel sheets where the same column can contain a value with % formatting and also with decimal notation.
To clarify: In Excel both have the same formatting but due to different Excel versions (locations) SSIS shows them like this:
1,3% or 0.814260540128523
These values come in as strings so I'm trying to figure out a way to divide the % formatted values by 100 and leave the others as is.
Initially I used:
(DT_R8)[F5_CONV] < 1 ? (DT_R8)[F5_CONV] : (DT_R8)[F5_CONV] / 100
in a second derived column but I then realized that 0,23% is also a possible value.
I think something like this should do it but I'm having trouble with the DT_WSTR and DT_R8 types.
(F5 == "" || ISNULL(F5)) ? NULL(DT_WSTR,40) : FINDSTRING(F5,"%",1) > 0
? (DT_WSTR,40)REPLACE(REPLACE(F5,".",","),"%","") / 100
: (DT_WSTR,40)REPLACE(F5,".",",")
Hope you can help me out here.
Thank you.
(F5 == "" || ISNULL(F5)) ? NULL(DT_WSTR,40) : FINDSTRING(F5,"%",1) > 0
? (DT_WSTR,40)((DT_R8)REPLACE(REPLACE(F5,".",","),"%","") / 100)
: (DT_WSTR,40)REPLACE(F5,".",",")
You can also use script component. Here is a quick solution; you may need to add validations for null. Let us know, if you need help.