Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have minimal knowledge of anything sql or programming. This is probably a very easy question, please help me!!
So the variable is HO, now, I want to only SELECT values in HO that are equal to 1. How do I do that?
if (HO=1,HO,null())
Hi,
if(HO=1, HO, null())
Regards.
Hi Jane
Wasn't sure if you meant variable or field as you typically would only have one value in a variable and you mentioned sql.
If you meant field then does the example below help?
Let us say that we have a field called HO that contains a range of values and you want to SELECT only the values where HO is equal to 1. So let us say your dataset is in a database and looks like this
For the sake of example we will say that you are using a SQLServer database where the database is 'Records' and the table name in which your data is stored is called 'Entries'.
If you are using SQL in your script to load the values of HO from a database then you can use the 'Where' clause in the script statement to limit the data that you load from the database.
For example:
Load
ID,
HO;
SQL Select
ID,
HO
From Records.dbo.Entries
Where HO =1;
The result of this is that the script will only load ID's 2,4 and 7 as they are the ones where the value of HO = 1.
If you are trying to achieve this in a chart rather than in the script then the suggestions in the answers by others above will work. If you wanted to count how many values of 1 you have in the HO field you could use set analysis using a set statement of =Count({$<HO={'1'}>}ID) which basically means 'count the number of ID's where the value of HO is 1'. This could for example be placed in a text box and would give the answer 3.
Hope that helps.
Kind regards
Steve
thank you!
You're most welcome. Glad it helped 🙂