Perform @CompIf function
Greetings,
I have a scenario where i need to do some records filtering by fulfiling 3 conditions in a single database file, e.g. Amount < 0, 'Low', Amount > 0 And Amount <=5, 'Moderate' and Amount > 5, 'High'. How am I able to perform those 3 conditions by Low, Moderate & High where in the end, I need to produce a graph based on those key conditions. I try use the @compif function, i.e. @CompIf(Amount < 0, "low", Amount > 0 .AND. Amount <= 5, "moderate", amount > 5, "high" ) and it returned a result that I'm not expecting of. How am I suppose to group the 3 conditions? What is the correct @function to use here or any solution/advice for me.
Thanks. William
Thanks Brian.
Thanks Brian.
If I would like to create a new amount virtual field from the same database, group and summarize those results in by 'low', 'moderate' & 'high', what would be my criteria looks like or any other suitable @function that I can use here? I need those summarization info in order to generate a graph.
Cheers, William
Hi Brian,
Hi Brian,
When I created the virtual field by inserting the @compif equation, it prompted me 'Error' either in equation or the virtual field. I try to perform the direct extraction with the same @Compif equation, the equation won't work and return the same number of records. I attached my Excel file for your reference. Appreciate to assist with my problem here.
Thanks, William
Hi William, that error is
Hi William, that error is easy to fix. What you are returing from your equation is a character, from what I can see of your equation you are returning "red" if the percentage is less than 0 but you have defined you virtual field as numeric, you need to define it as virtual character. When you get this error it means that the results of your equation are a different type then what your virtual field is expecting, in this instance the virtual field is expecting numeric but you are returning character.
Hi Brian,
Hi Brian,
With the working equation, my task now is to create a graph which I had done it in IDEA. However, upon automate it with IDEAscripting, my script "freezes". Not too sure where's the error here. Appreciate to assist to browse through the script and let me know the solution for my script.
Cheers, William
Hi William,
Hi William,
I am not sure why your forumla is giving you inconsistent results as it looks correct. I might write it a bit differently:
@CompIf(AMOUNT < 0, "low", AMOUNT <= 5, "moderate", 1, "high")
So I removed the AMOUNT > 0 as if amount is less than 0 it will be captured by the first part. The second part would capture anything less than or equal to 5 and the final portion is the default which would be anything that is greater than 5.
Let me know if you are getting inconsistent resutls and what those results might be.
I just looked at your forumula again and it looks like if you have any 0 items they would not be captured, is this what you want? In my formalu 0 items would be captured as moderate.
Brian