Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I apologize for posting daily...

Status
Not open for further replies.

wesleycrusher

Technical User
Sep 30, 2003
61
US
I apologize for posting daily...

I am grouping and using a formula for the title. The code reads a true/false from the DB and is supposed to determine which title to use and then group by the title. It is grouping fine but only "NATURAL OR PROPANE GAS" is appearing while blanks/whitespace show for the other group. I haven't figured out why it is showing two groups and not three but I suspect the problems are related.

Thanks, you all have been great helping me out this week.






If ({furnace_model.natural_gas_ind}="1" And {furnace_model.propane_gas_ind}="0") Then "NATURAL GAS";
If ({furnace_model.natural_gas_ind}="0" And {furnace_model.propane_gas_ind}="1") Then "PROPANE GAS";
If ({furnace_model.natural_gas_ind}="1" And {furnace_model.propane_gas_ind}="1") Then "NATURAL OR PROPANE GAS"
Else "";
 
You need to use some If/Else IF's in there. The way it's written now, the only thing that it will return is your last If (which is why you're getting "NATURAL OR PROPANE GAS" or nothing.

Try it like this:
Code:
If ({furnace_model.natural_gas_ind}="1" And {furnace_model.propane_gas_ind}="0") Then "NATURAL GAS"
Else If ({furnace_model.natural_gas_ind}="0" And {furnace_model.propane_gas_ind}="1") Then "PROPANE GAS"
Else If ({furnace_model.natural_gas_ind}="1" And {furnace_model.propane_gas_ind}="1") Then "NATURAL OR PROPANE GAS"
Else ""
-dave
 
I am using Crystal Syntax, so it doesn't recognize "Elseif" but does recognize "Else If". However, that still doesn't work.

If I switch to Basic Syntax and use "Elseif", I get "A statement is expected here" error before the first "Then".

Thanks again.



If ({furnace_model.natural_gas_ind}="1" And {furnace_model.propane_gas_ind}="0") Then "NATURAL GAS"
Else If ({furnace_model.natural_gas_ind}="0" And {furnace_model.propane_gas_ind}="1") Then "PROPANE GAS"
Else If ({furnace_model.natural_gas_ind}="1" And {furnace_model.propane_gas_ind}="1") Then "NATURAL OR PROPANE GAS"
Else ""
 
Dave's formula seems sound.

I suggest that you examine your logic/data, perhaps you have nulls?

If {furnace_model.natural_gas_ind}=&quot;1&quot; And {furnace_model.propane_gas_ind}<>&quot;1&quot; Then &quot;NATURAL GAS&quot;
Else If {furnace_model.propane_gas_ind}=&quot;1&quot; and{furnace_model.natural_gas_ind}<>&quot;1&quot; Then &quot;PROPANE GAS&quot;
Else If {furnace_model.natural_gas_ind}=&quot;1&quot; And {furnace_model.propane_gas_ind}=&quot;1&quot; Then &quot;NATURAL OR PROPANE GAS&quot;
Else &quot;N/A&quot;

Then place the

{furnace_model.natural_gas_ind}
and
{furnace_model.propane_gas_ind}

fields alongside this formula in the report so that you see what the combination is that's getting you.

-k
 
Thank you again everyone. Yep, it was the DB. I wasn't aware that there would be a case with two nulls. There are oil and gas furnaces, each being stored in the same DB so that threw it and me off. Sorry to trouble you all and thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top