Gossamer Forum
Home : Products : DBMan : Customization :

Zeros Not Showing Up In My Fields

Quote Reply
Zeros Not Showing Up In My Fields
I have a field in which a zero is a valid field and needs to be shown in the output (results) but dbman is skipping my zero fields. I do need the field to be skipped if it's a blank, so I can't substitute 1 for 0 in the default.cfg "not null" fields. The zeros do show up in the default.db file.

What can I do to make a 0 show up as a field?

Thanks so much!

Victoria



Quote Reply
Re: Zeros Not Showing Up In My Fields In reply to
I believe this was answered in another thread.

It's very useful when you keep your related databases questions in only one thread.

If you have problems, others can then view advice or solutions already provided Smile

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Zeros Not Showing Up In My Fields In reply to
I apologize, but I don't see how the following two responses, though appreciated, answer my question. The first suggestion, making '0' the default wouldn't work because I don't want these fields to show unless that zero is actually part of the horse's race record. (example: there are fields to enter information for a horse running from age 2 through 9 -- Secretariat only raced at 2 & 3, and I only want rows for 2 & 3 to show up in the results, not 0's for age 4, 0's for age 5, 0's for age 6, on up to age 9).

This is why I reposted -- thinking I'd perhaps not been clear as to the information I seek.

-----------------------

The $'s will still be showing because they have probobly been entered into the record. You'll have to check you .db file.

As for the 0, perl probobly thinks the 0 means "null". If you havent already, try setting the default as '0' (ie: with single quotes). See if that helps.

Good luck!

- Mark

Astro-Boy!!
http://www.zip.com.au/~astroboy/
-----------------------------------------------------------

It's best to not add the dollar sign and commas in the default value.

You could however add them to the display. Please visit the FAQ noted below and look under the section "Syntax" for a thead titled "Commas & Dollar Signs".

This will provide the solution you need for entering and displaying the dollar signs and commas.

Hope this helps

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/






Quote Reply
Re: Zeros Not Showing Up In My Fields In reply to
Ahh, I think I get it now. Smile

What you'd like to do is only display a table row if the horse raced during that age?

In that case, in your html_record sub-routine, you would do something like the following:

print qq|<table>|;
print qq|<tr><td>Age 2 information...</td></tr>| if ($rec{'Age2'} ne '0');
print qq|<tr><td>Age 3 information...</td></tr>| if ($rec{'Age3'} ne '0');
print qq|<tr><td>Age 4 information...</td></tr>| if ($rec{'Age4'} ne '0');
print qq|<tr><td>Age 5 information...</td></tr>| if ($rec{'Age5'} ne '0');
... etc ...
print qq|</table>|;


Now, this is just a guideline. I haven't seen your database structure or html.pl so I can't be sure exactly how you would set up the conditions... But basically, it sounds like you just need to set up some conditional rows. In my example above, each row will only print if the field AgeX does not equal "0".

Obviously you will need to fiddle with it a bit. If you're still stuck and don't mind posting your default.cfg and html.pl file in a web accessible area, we can check them out and might be able to get a better idea of what you're trying to do.

Good luck!

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/