Spotfire case statement - spotfire

I need to create a case statement in Spotfire please help.
Case WHEN UniqueCount([Product])<5 then UniqueConcatenate([Product]) else "Multipl Products"
WHEN UniqueCount([Division])<5 then UniqueConcatenate([Division]) else "Multipl Dev" END

per the documentation, CASE statements are only allowed a single ELSE. also I am assuming based on the provided example that you need two separate columns.
column 1 [Products]:
CASE
WHEN UniqueCount([Product])<5 then UniqueConcatenate([Product])
ELSE "Multiple Products"
END
column 2 [Divisions]:
CASE
WHEN UniqueCount([Division])<5 then UniqueConcatenate([Division])
else "Multiple Divisions"
END
if this doesn't answer, please edit your question for clarity.

Related

Grouping Classes & Subclasses in saved search

I'm trying to create a saved search that sums total sales by the parent class. I'm trying a CASE statement but can't seem to get it to work. This is what I have:
CASE
WHEN {class} LIKE 'B2B%’ THEN 'B2B'
WHEN {class} LIKE 'Amazon%’ THEN 'Amazon'
WHEN {class} LIKE 'Website%’ THEN ' B2C'
ELSE ‘’
END
Not sure why but that format never works for me either, although Netsuite documentation suggests that it should/does. Try nested CASE statements.
CASE WHEN {class} LIKE 'B2B' THEN 'B2B' ELSE
CASE WHEN {class} LIKE 'Amazon%' THEN 'Amazon' ELSE
CASE WHEN {class} LIKE 'Website%' THEN ' B2C' ELSE '' END
END
END
Or you can use SUBSTR({class},0,INSTR({class},':')-2) to get just the part of the string before " :", assuming all of your classes have these characters present.
Once you have that column formula working, group results based on this formula, add total sales as a column and group that but select "Sum".

NetSuite Case when statement on joined

I'm new to writing case statements in NetSuite and would appreciate any input with this. I'm trying to create following statement within item search, but receiving invalid expression error.
CASE WHEN {transaction.status} = "Purchase Order:Pending Receipt" THEN {transaction.expectedreceiptdate} end
CASE WHEN {transaction.status} = 'Pending Receipt' THEN {transaction.expectedreceiptdate} end
Note that you need to use single quotes in SQL statements, and you can't specify the transaction type as part of the status condition. To work araound this, you could include the transaction type in the criteria, or add another condition within the CASE statement:
CASE WHEN {transaction.status} = 'Pending Receipt' AND {transaction.type} = 'Purchase Order' THEN {transaction.expectedreceiptdate} end

Excel compare partial cell contents

I am currently comparing two lists of email address to find matches between the two.
=IF(ISERROR(MATCH(C2,Sheet1!Z:Z, 0)), "No Match", "Match")
My problem is that some emails I want to INCLUDE are for example :
John.Smith#Email.com
John.Smith-Work#Email.com
How can I do my match lookup to allow for this variance?
R3uK, close, stepping through your statement I found the following to work for me.
First Check:
=IFERROR(LEFT(G2,FIND("-",G2)-1)&RIGHT(G2,LEN(G2)-FIND("#",G2)+1), "")
Final Function
=IF(COUNTIF(TERMINATIONS!AA:AA,LEFT(G2,FIND("-",G2)-1)&RIGHT(G2,LEN(G2)-FIND("#",G2)+1))<1, "No Match", "Match")
With this you should be able to make it work.
=IF(COUNTIF(Sheet1!Z:Z,LEFT(C2,FIND(C2,"#"))&"*"&RIGHT(C2,LEN(C2)-FIND(C2,"#")))<1, "No Match", "Match")
Try =LEFT(C2,FIND(C2,"#"))&"*"&RIGHT(C2,LEN(C2)-FIND(C2,"#")) first,
to see if you have John.Smith*#Email.com or if you need to add a -1 or +1 somewhere!

Nested IF statement returning false

I have a nested if statement is returning "False" rather than the expected outcome.
Scenario
Table "High VoltageCables" has data in it that default to numeric but may contain characters: kVa
Table "Master" checks "High VoltageCables" data as blank or not blank, and returns "Failed Check 1","Passed Check 1". This works fine.
Table "Meta" then checks the results of "Master" and then tests "High VoltageCables" data for length between 1 and 6, regardless of whether record is numeric or string.
Formula
=IF(MASTER!H2="Passed Check 1",IF(LEN('High VoltageCables'!O2)>=1,IF(LEN('High VoltageCables'!O2<6),"Passed Check 2","Failed Check 2")))
This is partially succesful, as it returns "Passed Check 2" for the following sample data in the source table "High VoltageCables".
1 numeric, or
1kVa str, or
50000 numeric
However if a field in "High VoltageCables"is blank, the formula returns "FALSE" rather than "Failed Check 1"
I inherited this task, (and would have preferred to do the whole thing in Access using relatively simple queries) - and unfortunately I am new to nested If statements, so I am probably missing something basic...
NB the data in High VoltageCables must default to numeric for a further check to work.
The first and second IF's seem to be missing the else part. They should be added at the end between the ))) like ), else ), else )
Every IF statement consists of IF( condition, truepart, falsepart) if you have two nested ifs it will be something like IF( condition, IF( condition2, truepart2, falsepart2), falsepart)
Hope that makes it a little clearer
You do have an unaccounted for FALSE in the middle IF. Try bring the latter two conditions together.
=IF(Master!H2="Passed Check 1",IF(OR(LEN('High VoltageCables'!O2)={1,2,3,4,5}),"Passed Check 2","Failed Check 2"))
It's still a bit unclear on what to show or not show if Master!H2 does not equal "Passed Check 1".
I failed to construct the formula with a concluding "else" - "Failed Check 1"
Using jeeped's and Tom's suggestion and adding the final "else" part I have solved the problem:
=IF(MASTER!H2="Passed Check 1",IF(OR(LEN('High VoltageCables'!O2)={1,2,3,4,5}),"Passed Check 2","Failed Check 2"),"Failed Check 1")

select case with variable boolean operator

This is my first question on the forum, but reading previous questions has been enormously helpful in the project I'm working on, so already my thanks. I couldn't find an answer to this, but apologies if I overlooked something.
I am writing an excel macro in vba, and am trying to create a select case... statement in which the expression has a variable boolean and numeric component. For example, the macro can pull "> 3" or "< 3" from another worksheet.
My hope had been that I could assign to a string all of these parameters, i.e.:
test1 = "is " & BoolOperator1 & " " & NumericValue1
and then
Select case ValuetoCompare
Case test1
'Do something
Case test2
'...
Is there a way to do this? I suppose the alternative would be to nest the case with the numeric variable inside a select function that determines the operator, but I thought this would be more elegant.
Thanks in advance for your guidance--
Josh
Assuming that you'll get a string BoolOperator1 that is a valid operator, e.g. >=, =, and a numeric value NumericValue1, the easiest way to execute this comparison on another numeric value ValueToCompare is to use the Evaluate function. This will execute a string as VBA and return it's result.
In your case, you could simply use:
If Evaluate(ValueToCompare&BoolOperator1&NumericValue1) Then ...
If you want to use this in a Select Case statement, you'd either need to use a simple If ... ElseIf ... statement - or use this trick:
Select Case True
Case Evaluate(ValueToCompare&BoolOperator1&NumericValue1): ...
Case Evaluate(ValueToCompare&BoolOperator2&NumericValue2): ...
Case Else ...
End Select

Resources