Discussion:
Blanking Picture In a Report
(too old to reply)
Bruce R. Roland
2008-11-25 05:40:17 UTC
Permalink
Sorry folks for my poor use of the english language.

Where I said:

If the field in my table is a NULL the Picture format wil not display the way I want

What I meant was:

If the field in my table is a NULL the Picture format wil not display -Which is what I want

This is provided to prevent confusion over what I am trying to convey.

Bruce
Mervyn Bick
2008-11-25 06:52:54 UTC
Permalink
On Tue, 25 Nov 2008 07:32:38 +0200, Bruce R. Roland
Hello evryone,
I am running into a problem where I have PICTURE formats which print in
a report when a field is blank. I had this same problem in my forms but
it was easily solved there simply by clearing the PICTURE parameter for
the entryfield when the field value was empty (setting it to " " or
NULL) and reseting it when the field actually has a value.
.....
If I remove the Picture parameter where there is no no value I get the
desired result and this is somewhat on the line of what I do on the form
but I have not been able to find a way to do so on a report.
Any suggestions?
I'm assuming that you have stored the date in a character field as I find
that blank datefields print blank without any help. <g>

Use the canRender event for the field to blank it if it only has the
picture data.


function TEXTDTC1_canRender
if this.form.testdate1.rowset.fields["dtc"].value = " / / "
this.text = " "
else
this.text = this.form.testdate1.rowset.fields["dtc"].value
endif
return true


Mervyn.
Bruce R. Roland
2008-11-25 23:25:04 UTC
Permalink
Mervyn
Post by Mervyn Bick
I'm assuming that you have stored the date in a character field as I find
that blank datefields print blank without any help. <g>
You are exactly right on this. I had some issues with using the date field type and while I don't exactly recall what that was I found this to work much better for me.
Post by Mervyn Bick
Use the canRender event for the field to blank it if it only has the
picture data.
function TEXTDTC1_canRender
if this.form.testdate1.rowset.fields["dtc"].value = " / / "
this.text = " "
else
this.text = this.form.testdate1.rowset.fields["dtc"].value
endif
return true
Again what you are telling me here is alomost Identical to what I was trying with one exception - that is I was looking for the fields value to be "0" or "NULL" rather than " / / " since looking at the actual field value through a browse showed nothing as being there - this includes the " / / ". Therefore I will try this as well but am wondering if you can tell me as to why it would see " / / " as being there when it really is not. This seems strange to me - unless somehow the PICTURE formating is affecting the evaluation or value being evaluated even though " / / " is not actually stored in the file? Iguess this could happen but I do use "IZR" as a function which would show the PICTURE formatting on the form but would not store it in the field in the table - although I have found thewre is only some formatting which will not store and others that seem will regardless.

Any help with understanding this would be helpfull.

Bruce
Post by Mervyn Bick
Mervyn.
Mervyn Bick
2008-11-26 07:54:35 UTC
Permalink
On Wed, 26 Nov 2008 01:25:04 +0200, Bruce R. Roland
Post by Bruce R. Roland
Again what you are telling me here is alomost Identical to what I was
trying with one exception - that is I was looking for the fields value
to be "0" or "NULL" rather than " / / " since looking at the actual
field value through a browse showed nothing as being there - this
includes the " / / ". Therefore I will try this as well but am
wondering if you can tell me as to why it would see " / / " as being
there when it really is not. This seems strange to me - unless somehow
the PICTURE formating is affecting the evaluation or value being
evaluated even though " / / " is not actually stored in the file?
Iguess this could happen but I do use "IZR" as a function which would
show the PICTURE formatting on the form but would not store it in the
field in the table - although I have found thewre is only some
formatting which will not store and others that seem will regardless.
In my case the comparison is seeing " / / " because I put it in the
table I used to test with. <g> This reinforces the old saying, "Test data
is the only data the program will actually work with". <g>

I should have applied my mind a bit more and realised that you could be
using picture clauses to "pretty print" unformatted fields.


Mervyn.
Bruce R. Roland
2008-11-26 17:36:58 UTC
Permalink
Mervyn

I homestly think that this is the first time I ever heard using PICTURE to format unformated field values as "Pretty Print" . Sound a little "sissy" to me <Big Grin>.

Any way, I still was not able to blank the PICTURE format and after much trying I am beginning to think that this cannot be done in a report the way it can in a form due to something internal to DBase in the way in which it handles the objects when rendering them as opposed to simply accessing them. On the other hand I suppose it may be due to the objects I was doing this with in the form being control objects and all a report has is text objects so it may be the difference between the way in which DBase gives access to and handles the parameters of text objects as opposed to control objects. I simply don't know other than to say from my experience here in attempting this it does seem that it can't be done in a report even though it can be done in a form.

I did find a solution to what I wanted to do, though. What I did was to remove the PICTURE parameter from the report objects all together and to then use the left() and right() commands to seperate the month, day and year out to seperate values and then recompose the date adding the formating. This works well and gives me the desired effect if the field value is of character type. I was not so successful when I applied this method to a numerical value but I am sure I am on the right track there and will soon find a solution to that as well.

Thanks to all for the help on this.

Bruce
Mervyn Bick
2008-11-26 18:37:32 UTC
Permalink
On Wed, 26 Nov 2008 19:36:58 +0200, Bruce R. Roland
Post by Mervyn Bick
Mervyn
I homestly think that this is the first time I ever heard using PICTURE
to format unformated field values as "Pretty Print" . Sound a little
"sissy" to me <Big Grin>.
Any way, I still was not able to blank the PICTURE format and after much
trying I am beginning to think that this cannot be done in a report the
way it can in a form due to something internal to DBase in the way in
which it handles the objects when rendering them as opposed to simply
accessing them. On the other hand I suppose it may be due to the
objects I was doing this with in the form being control objects and all
a report has is text objects so it may be the difference between the way
in which DBase gives access to and handles the parameters of text
objects as opposed to control objects. I simply don't know other than
to say from my experience here in attempting this it does seem that it
can't be done in a report even though it can be done in a form.
The canRender functions I posted were copied from a test report and they
both worked. For the first one I had " / / " stored in a field of the
test table. After you pointed out that you were using a PICTURE clause
(Again! You had said so in the first post but it hadn't registered.) I
changed the report by adding the PICTURE ("@R ##/##/##") and the table by
making the date field blank. The second function worked for me.

function TEXTDTC1_canRender
if this.form.testdate1.rowset.fields["dtc"].value = " "
this.picture = " "
else
this.picture = "@R ##/##/##"
endif
return true
Post by Mervyn Bick
I did find a solution to what I wanted to do, though. What I did was to
remove the PICTURE parameter from the report objects all together and to
then use the left() and right() commands to seperate the month, day and
year out to seperate values and then recompose the date adding the
formating. This works well and gives me the desired effect if the field
value is of character type. I was not so successful when I applied this
method to a numerical value but I am sure I am on the right track there
and will soon find a solution to that as well.
For the numerical fields you would need to change this slightly as they
will probably hold 0.00 and not " ". (Not tested)

function TEXTDTC1_canRender
if this.form.testdate1.rowset.fields["dtc"].value = " "
this.value = " "
this.picture = " "
else
this.value = this.form.testdate1.rowset.fields["dtc"].value
this.picture = "@J 999999.99"
endif
return true




If it works, it's not wrong. <g> I'm glad you were able to work something
out.

Mervyn.
Bruce R. Roland
2008-11-26 18:59:41 UTC
Permalink
Mervyn
Post by Mervyn Bick
If it works, it's not wrong. <g> I'm glad you were able to work something
out.
You are absolutely right about that. results speak a lot.

It may be that the other way would work had something else in my code been slightly different - I will never know as obviously - since I have it going this way - I probably will not pursue it another way.

There has ben a lot of discussion generated by my queries as to the right way and the wrong way to do things - what should be done and should not be done. All the points may be valid but it is hard for an amature like myself to apply those without any undestanding of them and when the OLH or Ken's books discuss something - even if it is discussed only because the command or language is out there and that makes it neccessary to be discussed - it is hard for us amatures to sort out what is and is not good programming without understanding. As we tend to be more results oriented rather than "programatically correct" we will make these mistakes until we learn and understand not only what is right but why. Until then we will probably continue to use code incorrectly as per our interpretation of what is available to us for reference.

Any way - Apologies for the rambling and thanks for your assistance.

Bruce
Marilyn Price
2008-11-27 13:35:52 UTC
Permalink
Post by Bruce R. Roland
I was not so successful when I applied this method to a numerical
value but I am sure I am on the right track there and will soon
find a solution to that as well.
If you're open to another suggestion, especially for numerics, how about
something like this (this will wrap incorrectly):

text = {||iif(empty(this.form.query.rowset.fields["nofield"].value), '',
transform(this.form.query.rowset.fields["nofield"].value,
"999,999.99"))}

or whatever picture you wanted to use.
--
Marilyn Price
M. P. Data
Bruce R. Roland
2008-11-27 13:58:50 UTC
Permalink
Marilyn

Thanks for the input. I had used the transform quite a bit when printing in DOS and it worked well. I had heard and seen suggestions on using it in DBase Plus but wasn't sure how to do it in PLUS. Your example has given me a good idea how to do this so I will go back and try it.

I had tried the IIF statement you sugest. Someone else had also reccommended that as well. I had tried that earlier but I did not have luck with that - I don't know why although I suspect after a lot of the info that folks have given me it had to do with my evaluation clause. I will be trying this again as it would be a lot easier than having a full function that does almost the identical thing.

Thanks for the input

Bruce
Marilyn Price
2008-11-28 13:32:45 UTC
Permalink
Post by Marilyn Price
Marilyn
Thanks for the input.
There's always more than one way to do things in dBase. Just pointing
out another.

You're welcome.
--
Marilyn Price
M. P. Data
Bruce R. Roland
2008-11-27 15:32:03 UTC
Permalink
Marilyn
Post by Marilyn Price
If you're open to another suggestion, especially for numerics, how about
text = {||iif(empty(this.form.query.rowset.fields["nofield"].value), '',
transform(this.form.query.rowset.fields["nofield"].value,
"999,999.99"))}
or whatever picture you wanted to use.
If you see my other post in reply to this, Marilyn, you will see I had said I had tried this at one point but it did not work - I believed because I had my evaluation clause incorrect. Well, With your sample I tried it again and it works great - this is exactly what I needed - just a point in the right direction and a sample of the syntax to get it right was all I needed I guess.

Thanks. Problem solved.

As a last note on this - a question actually. I know you can truncate/wrap long command lines with the use of the ";" to continue them to the next line for the convenience of making it so the command line is more visible when displayed in the command window. I have tried this with some commands such as the IIF statements we use here but that seems to not wrap them so much as break them in such a way that dbase considers them as two seperate (and incomplete) commands. I assume by this that while dbase will allow you to wrap command lines in this fashion it will not allow the wrapping of commands. (i.e., the command line:

Picture = "##/##/##"

could be written in code as:

Picture =;
"##/##/##"

and would work just as if a single line. However:

IIF(<something>,<do this>, <or do this>)

cannot be written it seems to me as:

IIF(<something>,;
<do this>, <or do this>)

Is there a way to wrap a long single command similar to this as to can be done with the ";" for long command lines.

Bruce
Mervyn Bick
2008-11-27 16:18:23 UTC
Permalink
On Thu, 27 Nov 2008 17:32:03 +0200, Bruce R. Roland
Post by Bruce R. Roland
Is there a way to wrap a long single command similar to this as to can
be done with the ";" for long command lines.
Bruce
Using Marilyn's example, which is all in one LONG line

text = {||iif(empty(this.form.query.rowset.fields["nofield"].value), '',
transform(this.form.query.rowset.fields["nofield"].value,"999,999.99"))}

I've never actually tried to use the continuation character ";" in an
IIF() or codeblock but if it doesn't work you can factor out the various
bits and pieces into variables and use them in the IIF() or codeblock ie


nNoFldVal = this.form.query.rowset.fields["nofield"].value
text = {||iif(empty(nNoFldVal), ' ',transform(nNoFldVal,"999,999.99))}


Mervyn.
Bruce R. Roland
2008-11-27 16:29:34 UTC
Permalink
Mervyn

Yeah! I did think of that and know it will work. I just like to keep my number of code lines to a minimu so it is a trowoff - shorter lines that display better or more of them!

Bruce
Frank J. Polan
2008-11-27 19:28:51 UTC
Permalink
Bruce

the continuation character will work in an IIF statement

here are 2 examples from working program. Hmm, hard to see the way
the news reader wrapped it, but it's there
-------------------------------
/* calculate form values */
this.f.width := iif(this.f.title.width >
this.f.entryfield1.width, ;
this.f.title.width * 2,
this.f.entryfield1.width * 2)
---------------------------------------------

nLength = IIF( this.parent.LookupContainer.catalogueRB.value ,15
,;
IIF(
this.parent.LookupContainer.descriptionRB.value,32 ,5 ) )
-----------------------------------------------------------------------------------------
HTH

Frank Polan

On Thu, 27 Nov 2008 10:32:03 -0500, Bruce R. Roland
Post by Marilyn Price
Marilyn
Post by Marilyn Price
If you're open to another suggestion, especially for numerics, how about
text = {||iif(empty(this.form.query.rowset.fields["nofield"].value), '',
transform(this.form.query.rowset.fields["nofield"].value,
"999,999.99"))}
or whatever picture you wanted to use.
If you see my other post in reply to this, Marilyn, you will see I had said I had tried this at one point but it did not work - I believed because I had my evaluation clause incorrect. Well, With your sample I tried it again and it works great - this is exactly what I needed - just a point in the right direction and a sample of the syntax to get it right was all I needed I guess.
Thanks. Problem solved.
Picture = "##/##/##"
Picture =;
"##/##/##"
IIF(<something>,<do this>, <or do this>)
IIF(<something>,;
<do this>, <or do this>)
Is there a way to wrap a long single command similar to this as to can be done with the ";" for long command lines.
Bruce
Bruce R. Roland
2008-11-27 22:35:13 UTC
Permalink
Frank
Post by Frank J. Polan
the continuation character will work in an IIF statement
here are 2 examples from working program. Hmm, hard to see the way
the news reader wrapped it, but it's there
-------------------------------
/* calculate form values */
this.f.width := iif(this.f.title.width >
this.f.entryfield1.width, ;
this.f.title.width * 2,
this.f.entryfield1.width * 2)
---------------------------------------------
nLength = IIF( this.parent.LookupContainer.catalogueRB.value ,15
,;
IIF(
this.parent.LookupContainer.descriptionRB.value,32 ,5 ) )
-----------------------------------------------------------------------------------------
HTH
Frank Polan
Looks like you are using the "continuation character ( ;)" immeadiately after one of the commas. I believe I had tried this but I made the assuption that it was not working as the color of the text in the line changed from the blue it is when correct and complete to the red color you normally see when a command line is incomplete or missing something. But if you have used this then there must be a way to do it so with that encouragement - I will try it again.

Thanks

Bruce
Bruce R. Roland
2008-11-27 22:55:37 UTC
Permalink
Frank
Post by Bruce R. Roland
Looks like you are using the "continuation character ( ;)" immeadiately after one of the commas. I believe I had tried this but I made the assuption that it was not working as the color of the text in the line changed from the blue it is when correct and complete to the red color you normally see when a command line is incomplete or missing something. But if you have used this then there must be a way to do it so with that encouragement - I will try it again.
Just went back and tried this and it does seem to work. As I said, however, the text of the command line (viewing it in the source editor) changes from blue to red - or depending on where you put the continuation character - a combination of blue/red/black which is confusing since this usually is an indication that there is something DBase does not like about the way the command is written or there is some other problem with the command. Thus, while it does work I am a little leery of it until I understand why the change in color is occurring and what it means or is trying to tell me.

Any input on this appreciated!

Bruce
Frank J. Polan
2008-11-28 02:37:16 UTC
Permalink
Bruce

The only way I can duplicate the blue/red indication is when I split a
command line and leave out the continuation character

You might want to post a sample that does it so someone can take a
look at it

Frank Polan


On Thu, 27 Nov 2008 17:55:37 -0500, Bruce R. Roland
Post by Bruce R. Roland
Frank
Post by Bruce R. Roland
Looks like you are using the "continuation character ( ;)" immeadiately after one of the commas.
I believe I had tried this but I made the assuption that it was not
working as the color of the text in the line changed from the blue it
is when correct and complete to the red color you normally see when a
command line is incomplete or missing something. But if you have used
this then there must be a way to do it so with that encouragement - I
will try it again.
Post by Bruce R. Roland
Just went back and tried this and it does seem to work. As I said, however, the text of the command line (viewing it in the source editor) changes from blue to red - or depending on where you put the continuation character - a combination of blue/red/black which is confusing since this usually is an indication that there is something DBase does not like about the way the command is written or there is some other problem with the command. Thus, while it does work I am a little leery of it until I understand why the change in color is occurring and what it means or is trying to tell me.
Any input on this appreciated!
Bruce
Geoff Wass [dBVIPS]
2008-11-28 05:57:16 UTC
Permalink
Post by Bruce R. Roland
Frank
Post by Bruce R. Roland
Looks like you are using the "continuation character ( ;)" immeadiately after one of the commas. I believe I had tried this but I made the assuption that it was not working as the color of the text in the line changed from the
blue it is when correct and complete to the red color you normally see when a command line is incomplete or missing something. But if you have used this then there must be a way to do it so with that encouragement - I will try it
again.
Post by Bruce R. Roland
Just went back and tried this and it does seem to work. As I said, however, the text of the command line (viewing it in the source editor) changes from blue to red - or depending on where you put the continuation character - a
combination of blue/red/black which is confusing since this usually is an indication that there is something DBase does not like about the way the command is written or there is some other problem with the command. Thus, while it
does work I am a little leery of it until I understand why the change in color is occurring and what it means or is trying to tell me.
Post by Bruce R. Roland
Any input on this appreciated!
Bruce
Bruce,

The miscoloration is a known bug in the source editor. As long as it
runs, don't worry about it.
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada

.|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
.|.|.| IT Consultant http://Geoff_Wass.com |.|.|.
Bruce R. Roland
2008-11-28 12:11:13 UTC
Permalink
Geoff
Post by Geoff Wass [dBVIPS]
The miscoloration is a known bug in the source editor. As long as it
runs, don't worry about it.
This is god to know. I will now know to try things even if I get this indication. In the past I simply didn't because of the indication - so I amy have to go back and revisit some of the things I tried previously, but ...

Thanks.

Bruce
Geoff Wass [dBVIPS]
2008-11-29 06:05:49 UTC
Permalink
Post by Bruce R. Roland
Geoff
Post by Geoff Wass [dBVIPS]
The miscoloration is a known bug in the source editor. As long as it
runs, don't worry about it.
This is god to know. I will now know to try things even if I get this indication. In the past I simply didn't because of the indication - so I amy have to go back and revisit some of the things I tried previously, but ...
Thanks.
Bruce
Bruce,

You're welcome.
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada

.|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
.|.|.| IT Consultant http://Geoff_Wass.com |.|.|.
Bruce R. Roland
2008-11-27 23:06:02 UTC
Permalink
Frank
I think the built in dBASE editor (which I don't use) sees it as an
error but it compiles okay.
Just a little disconcerting for the newbie and confusing in that it makes you think something won't work or is incorrect when it may not be. A fix to this to eliminate the confusion might be in order unless it is WAD and someone can explain this.

Bruce
Frank J. Polan
2008-11-27 22:49:34 UTC
Permalink
Bruce

I think the built in dBASE editor (which I don't use) sees it as an
error but it compiles okay.

Frank Polan

On Thu, 27 Nov 2008 17:35:13 -0500, Bruce R. Roland
Post by Bruce R. Roland
Frank
Post by Frank J. Polan
the continuation character will work in an IIF statement
here are 2 examples from working program. Hmm, hard to see the way
the news reader wrapped it, but it's there
-------------------------------
/* calculate form values */
this.f.width := iif(this.f.title.width >
this.f.entryfield1.width, ;
this.f.title.width * 2,
this.f.entryfield1.width * 2)
---------------------------------------------
nLength = IIF( this.parent.LookupContainer.catalogueRB.value ,15
,;
IIF(
this.parent.LookupContainer.descriptionRB.value,32 ,5 ) )
-----------------------------------------------------------------------------------------
HTH
Frank Polan
Looks like you are using the "continuation character ( ;)" immeadiately after one of the commas. I believe I had tried this but I made the assuption that it was not working as the color of the text in the line changed from the blue it is when correct and complete to the red color you normally see when a command line is incomplete or missing something. But if you have used this then there must be a way to do it so with that encouragement - I will try it again.
Thanks
Bruce
Marilyn Price
2008-11-28 13:38:02 UTC
Permalink
Post by Bruce R. Roland
As a last note on this - a question actually. I know you can
truncate/wrap long command lines with the use of the ";" to
continue them to the next line for the convenience of making
it so the command line is more visible when displayed in the
command window. I have tried this with some commands such as
the IIF statements we use here but that seems to not wrap them
so much as break them in such a way that dbase considers them
as two seperate (and incomplete) commands. I assume by this
that while dbase will allow you to wrap command lines in this
fashion it will not allow the wrapping of commands.
As you now know, command lines usually can be continued with the
semicolon.

One thing you may have had problems with in using the semicolon is code
blocks. I don't know about the current versions of dBase, but most of
the older versions didn't like code blocks continued onto another line.
Romain came up with a way to make it work, but it was convoluted and
involved double semicolons - one at the end of the first line and one at
the beginning of the other.

As I said, I don't know if this restriction still applies. I tend to
leave them as one long line in the reports because of problems in the
past.
--
Marilyn Price
M. P. Data
Bruce R. Roland
2008-11-29 01:50:25 UTC
Permalink
Marilyn
Post by Marilyn Price
As you now know, command lines usually can be continued with the
semicolon.
One thing you may have had problems with in using the semicolon is code
blocks. I don't know about the current versions of dBase, but most of
the older versions didn't like code blocks continued onto another line.
Romain came up with a way to make it work, but it was convoluted and
involved double semicolons - one at the end of the first line and one at
the beginning of the other.
As I said, I don't know if this restriction still applies. I tend to
leave them as one long line in the reports because of problems in the
past.
FYI and FWIW - If you read some of the posts on this subject you will see more on this. As it turns out using the ":" to wrap the IIF command line you referenced for me does indeed work. The problem was I was misled by DBase into thinking it would not due to the coloration results I got in the source editor. But as someone pointed out, Ken reiterated, and I found out by trying it - it does work even though the coloration changes would make you think it doesn't.

Ken has pointed out that there is apparently a bug of which they are aware which causes this so I would assume someone is working on it.

Bruce
Bruce R. Roland
2008-11-29 01:55:16 UTC
Permalink
Marilyn
Post by Bruce R. Roland
Ken has pointed out that there is apparently a bug of which they are aware which causes this so I would assume someone is working on it.
Correction it was Geoff pointed this out to me. See post at 12:57 am today from Geoff on this subject.

Bruce
Bruce R. Roland
2008-11-26 03:22:33 UTC
Permalink
Mervyn

This is an update to my 6:25 reply to your 1:05 reply.

After going back to what I was doing and trying what you suggested I realized two things.

First this is exactly what I am doing with the billing rate on my invoice - i.e., I look at the "units" of service provided and if they are "0" then I blank out the billing rate by setting the text to " " and resetting the text to the original value when there is are any "units" of service value for that line of the invoice. In fact I use exactly what you suggest for this - and it works fine for that purpose.

Second, that I may need to explain the problem further to convey what I am trying to do - that is to not blank the text but rather the PICTURE formatting.

That is to say - when the date field in the table has no value(is empty or null) the report will print " / / " in the space for the date even though the date is otherwise blank - Ditto for the ":" in the time field and the "." in the rate field on the printed report. See the following sample of what I get when printing an invoice (running the invoice report):

Date Time Description Units Rate ............
1 11/04/08 1:15 Counseling Services 1.00 6.00 ............
2 11/09/08 4:45 Counseling Services 1.50 6.00 ............
3 / / : . ...........
4 / / : . ...........

Etc to bottom of invoice ....

What I want:

Date Time Description Units Rate ............
1 11/04/08 1:15 Counseling Services 1.00 6.00 ............
2 11/09/08 4:45 Counseling Services 1.50 6.00 ............
3 ...........
4 ...........

Etc to bottom of invoice ....


I.E., What I wouild like to do is make the report so it will not print the formatting characters " / / " or ":" or "." for these fields when there is no value for them in the table.

On the form associated with this report I had this same problem but was able to resole it by essentially changing the Picture format to a blank (i.e., by changing "PICTURE = "##/##/##" to "PICTURE = NULL "). This was done simply with the following:

IF val(oFields[cDate_Field_Ref].VALUE) = 0 OR oFields[cDate_Field_Ref].VALUE = NULL
&oDate_Object_Ref := NULL
ENDIF

IF VAL(oFields[cTime_Field_Ref].VALUE) = 0 or oFields[cTime_Field_Ref].VALUE = NULL
&oTime_Object_Ref := NULL
ENDIF

with "oDate_Object_Ref" and "oTime_Object_Ref " being a reference to the date and time object's picture parameter respectively. This works well to blank the picture formats on the form.

I now need to this on the report as well but this is where I am having trouble. That is to say that everything I have tried to do to set the Picture parameter to a NULL in the report has not worked and this is what I need to do. Never mind a value - since there is no value for the field in the table it will show no value anyway. It is only the PICTURE formatting characters " / / ", ":" and "." that I need to blank and the only way I can see is by finding a way to NULL the picture parameter for the object when the tables field is emptyt or Null. Since it seems to do this automatically when the field is NULL I only need to worry about when the field is empty.

I hope this helps clarify what I am trying to do.

Thanks

Bruce
Post by Mervyn Bick
I'm assuming that you have stored the date in a character field as I find
that blank datefields print blank without any help. <g>
Use the canRender event for the field to blank it if it only has the
picture data.
function TEXTDTC1_canRender
if this.form.testdate1.rowset.fields["dtc"].value = " / / "
this.text = " "
else
this.text = this.form.testdate1.rowset.fields["dtc"].value
endif
return true
Mervyn.
Mervyn Bick
2008-11-26 08:21:52 UTC
Permalink
On Wed, 26 Nov 2008 09:57:16 +0200, Mervyn Bick <invalid.invalid.invalid>
Post by Mervyn Bick
function TEXTDTC1_canRender
if this.form.testdate1.rowset.fields["dtc"].value = " "
this.text = " "
Mind in neutral! The line above is quite unnecessary. The value being
passed from the table is blank to start with
Post by Mervyn Bick
this.picture = " "
else
this.text =
this.form.testdate1.rowset.fields["dtc"].value
The line above is also unnecessary
Post by Mervyn Bick
endif
return true
function TEXTDTC1_canRender
if this.form.testdate1.rowset.fields["dtc"].value = " "
this.picture = " "
else
this.picture = "@R ##/##/##"
endif
return true


Mervyn.
Bruce R. Roland
2008-11-26 18:17:52 UTC
Permalink
Mervyn

Had tried exactly this. Why it would not work I don't know. See my most recent postings on this you will see I have resolved this issue in another fashion and my thoughts on why this may have not worked although my thoughts may not be right. I am sure you can be more direct on what is going on - my comments are simply made on gut feelings and nothing concrete.

Bruce
Mervyn Bick
2008-11-26 07:57:16 UTC
Permalink
On Wed, 26 Nov 2008 05:22:33 +0200, Bruce R. Roland
<***@velocity.net> wrote:


Firstly, i think we need to change the Subject of the thread to "Blankety
blank Picture in a Report". <g>
Post by Bruce R. Roland
Second, that I may need to explain the problem further to convey what I
am trying to do - that is to not blank the text but rather the PICTURE
formatting.
Mm. I understand. Try the following. I'm assuming that the field for the
date either contains something like "110408" or " ".


function TEXTDTC1_canRender
if this.form.testdate1.rowset.fields["dtc"].value = " "
this.text = " "
this.picture = " "
else
this.text = this.form.testdate1.rowset.fields["dtc"].value
this.picture = "@R ##/##/##"
endif
return true


Mervyn.
unknown
2008-11-26 20:09:06 UTC
Permalink
On Tue, 25 Nov 2008 22:22:33 -0500 Bruce R. Roland
Sender: Bruce R. Roland <***@velocity.net>
wrote the following in:
Newsgroup: dbase.getting-started
Post by Bruce R. Roland
Date Time Description Units Rate ............
1 11/04/08 1:15 Counseling Services 1.00 6.00 ............
2 11/09/08 4:45 Counseling Services 1.50 6.00 ............
3 / / : . ...........
4 / / : . ...........
Etc to bottom of invoice ....
Date Time Description Units Rate ............
1 11/04/08 1:15 Counseling Services 1.00 6.00 ............
2 11/09/08 4:45 Counseling Services 1.50 6.00 ............
3 ...........
4 ...........
Bruce,

I have tried to follow this thread and found it difficult to understand what you are doing.

As I know nothing about reports I used the report wizard to create a report based on a table
containing a date field and a timestamp field, some of which are blank. When the report is displayed
on the screen the locations corresponding to the blank tablefields are also blank. Is that the kind
of result you are looking for?

Save and run the code below my signature to see the demo.


Ivar B. Jessen

//----- Save as Orders.prg -----
create table Orders(ID integer, fDate date, fTimeStamp timestamp)
insert into Orders (ID) values (1)
insert into Orders values (2, "26.11.2008", "26.11.2008 10:20:30")
insert into Orders (ID) values (3)
//-----


//----- Save as Orders.rep -----
//
// Generated on 26-11-2008
//
local r
r = new ORDERSReport()
r.render()

class ORDERSReport of REPORT
with (this)
title = "Orders"
endwith

this.ORDERS1 = new QUERY()
this.ORDERS1.parent = this
with (this.ORDERS1)
left = -15.0
top = -15.0
sql = 'select * from Orders'
requestLive = false
active = true
endwith

with (this.printer)
duplex = 1 // None
orientation = 1 // Portrait
paperSource = 7
paperSize = 9
resolution = 3 // Medium
color = 2 // Color
trueTypeFonts = 2 // Download
endwith

this.STREAMSOURCE1 = new STREAMSOURCE(this)
this.STREAMSOURCE1.detailBand.TITLETEXTID1 = new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TITLETEXTID1)
canRender = {||this.parent.firstOnFrame}
height = 293.0
left = 0.0
top = 0.0
width = 3090.0
prefixEnable = false
alignHorizontal = 2 // Right
suppressIfBlank = true
text = "<H3>Id</H3>"
endwith

this.STREAMSOURCE1.detailBand.TEXTID1 = new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TEXTID1)
height = 1.0
left = 0.0
top = 293.0
width = 3090.0
variableHeight = true
prefixEnable = false
alignHorizontal = 2 // Right
text = {||this.form.orders1.rowset.fields["ID"].value}
endwith

this.STREAMSOURCE1.detailBand.TITLETEXTFDATE1 = new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TITLETEXTFDATE1)
canRender = {||this.parent.firstOnFrame}
height = 293.0
left = 3240.0
top = 0.0
width = 645.0
prefixEnable = false
suppressIfBlank = true
text = "<H3>Fdate</H3>"
endwith

this.STREAMSOURCE1.detailBand.TEXTFDATE1 = new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TEXTFDATE1)
height = 1.0
left = 3234.0
top = 293.0
width = 4000
variableHeight = true
prefixEnable = false
text = {||this.form.orders1.rowset.fields["fDate"].value}
endwith

this.STREAMSOURCE1.detailBand.TITLETEXTFTIMESTAMP1 = new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TITLETEXTFTIMESTAMP1)
canRender = {||this.parent.firstOnFrame}
height = 293.0
left = 6000
top = 0.0
width = 1349.0
prefixEnable = false
suppressIfBlank = true
text = "<H3>Ftimestamp</H3>"
endwith

this.STREAMSOURCE1.detailBand.TEXTFTIMESTAMP1 = new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TEXTFTIMESTAMP1)
height = 1.0
left = 6000
top = 293.0
width = 6000
variableHeight = true
prefixEnable = false
text = {||this.form.orders1.rowset.fields["fTimeStamp"].value}
endwith

this.PAGETEMPLATE1 = new PAGETEMPLATE(this)
with (this.PAGETEMPLATE1)
height = 16837.0
width = 11905.0
marginTop = 1080.0
marginLeft = 1080.0
marginBottom = 1080.0
marginRight = 1080.0
gridLineWidth = 0
endwith

this.PAGETEMPLATE1.STREAMFRAME1 = new STREAMFRAME(this.PAGETEMPLATE1)
with (this.PAGETEMPLATE1.STREAMFRAME1)
height = 11592.0
left = 360.0
top = 1365.0
width = 9360.0
form.STREAMFRAME1 = form.pagetemplate1.streamframe1
endwith

this.PAGETEMPLATE1.TEXT1 = new TEXT(this.PAGETEMPLATE1)
with (this.PAGETEMPLATE1.TEXT1)
height = 524.0
left = 5000
top = 360.0
width = 7000
prefixEnable = false
text = "<H1>Orders</H1>"
form.TEXT1 = form.pagetemplate1.text1
endwith

this.firstPageTemplate = this.form.pagetemplate1
this.form.pagetemplate1.nextPageTemplate = this.form.pagetemplate1
this.form.pagetemplate1.streamframe1.streamSource = this.form.streamsource1
this.form.streamsource1.rowset = this.form.orders1.rowset
endclass
//-----
Bruce R. Roland
2008-11-27 03:55:32 UTC
Permalink
Ivar
Post by unknown
I have tried to follow this thread and found it difficult to understand what you are doing.
As I know nothing about reports I used the report wizard to create a report based on a table
containing a date field and a timestamp field, some of which are blank. When the report is displayed
on the screen the locations corresponding to the blank tablefields are also blank. Is that the kind
of result you are looking for?
You essentially have said what I am running into with just a little twist to it. The twist is that when I create a table all fields have a NULL value to begin with it seems. When I use a form to enter data into the table, obviously the fields into which I enter data no longer have a NULL value but now have the value entered (this sounds like I am stating the obvious - and I am for explanation purposes). For those fields which I do not enter a value - the value remains a NULL.

In the case of a date or time field for which nothing has been entered - the value is still a NULL. When I run the report what is displayed on screen at the locations corresponding to the "NULL" tablefields are blanks <emphasis added to it being a "NULL" fields which display as blanks>. This I believe from what you said is what you got as well - albeit you used the term "Blank" instead of "NULL" and as you read futher you will see - I believe - why I emphasize the difference between "NULL" and "Blank" here.

If a value is entered into - say - a date field - and hence the value became something other than the original "NULL" value - and then the date was later subsequently erased for whatever reason - the value of the field is no longer the date value entered (obvious since it was erased) nor is it the original NULL value - it is instead an EMPTY string value or in essence a "0" value.

Now when the report is run the locations corresponding to the now blank field -"EMPTY" not "NULL" - which previously displayed a blank at the corresponding field location in the report - now instead displays the " / / " (PICTURE FORMAT) to which I was referring.

So yes, in a way what you were seeing was what I want and was seeing on untouched fields - what I was/am getting if there was never any data in the field at any time prior to the report being run.

However, that is not what I was/am getting for essentially blank fields if there was indeed ever a value entered in the field and then it had been cleared or erased later.

As I said the only explanation I can come up with is the concept of the field value originally being a "NULL" and afterwards being not "NULL" but an empty string instead.

I know it has been pointed out that an empty string is not a NULL in several posts and this seems to be a very good example which shows that difference.

I hope this helps you understand what I was trying to do and what I was getting.

Please note also my earlier post indicating my found solution to this problem with respect to character fields in a table.

Bruce
Geoff Wass [dBVIPS]
2008-11-27 05:45:06 UTC
Permalink
Post by Bruce R. Roland
Ivar
Post by unknown
I have tried to follow this thread and found it difficult to understand what you are doing.
As I know nothing about reports I used the report wizard to create a report based on a table
containing a date field and a timestamp field, some of which are blank. When the report is displayed
on the screen the locations corresponding to the blank tablefields are also blank. Is that the kind
of result you are looking for?
You essentially have said what I am running into with just a little twist to it. The twist is that when I create a table all fields have a NULL value to begin with it seems. When I use a form to enter data into the table,
obviously the fields into which I enter data no longer have a NULL value but now have the value entered (this sounds like I am stating the obvious - and I am for explanation purposes). For those fields which I do not enter a value
- the value remains a NULL.
Post by Bruce R. Roland
In the case of a date or time field for which nothing has been entered - the value is still a NULL. When I run the report what is displayed on screen at the locations corresponding to the "NULL" tablefields are blanks <emphasis
added to it being a "NULL" fields which display as blanks>. This I believe from what you said is what you got as well - albeit you used the term "Blank" instead of "NULL" and as you read futher you will see - I believe - why I
emphasize the difference between "NULL" and "Blank" here.
Post by Bruce R. Roland
If a value is entered into - say - a date field - and hence the value became something other than the original "NULL" value - and then the date was later subsequently erased for whatever reason - the value of the field is no
longer the date value entered (obvious since it was erased) nor is it the original NULL value - it is instead an EMPTY string value or in essence a "0" value.
Post by Bruce R. Roland
Now when the report is run the locations corresponding to the now blank field -"EMPTY" not "NULL" - which previously displayed a blank at the corresponding field location in the report - now instead displays the " / / "
(PICTURE FORMAT) to which I was referring.
Post by Bruce R. Roland
So yes, in a way what you were seeing was what I want and was seeing on untouched fields - what I was/am getting if there was never any data in the field at any time prior to the report being run.
However, that is not what I was/am getting for essentially blank fields if there was indeed ever a value entered in the field and then it had been cleared or erased later.
As I said the only explanation I can come up with is the concept of the field value originally being a "NULL" and afterwards being not "NULL" but an empty string instead.
I know it has been pointed out that an empty string is not a NULL in several posts and this seems to be a very good example which shows that difference.
I hope this helps you understand what I was trying to do and what I was getting.
Please note also my earlier post indicating my found solution to this problem with respect to character fields in a table.
Bruce
Bruce,

This is the basic approach I use for handle your situation. I set one
.picture and leave it. I then use the following to return a value that
will suit that picture and display what I want when the value is 0 or
NULL (which is what the empty() function tests for).
Post by Bruce R. Roland
picture = "99999"
function = ""
text = {|| iif( empty( this.form.datamodule1.table1.rowset.fields["Field1"].value ), "", this.form.datamodule1.table1.rowset.fields["Field1"].value ) }
For dates I will sometimes use a .picture for a character string and the
the .text to convert the date to a string (or, if the date is empty, to
what I want to see when there is no date).
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada

.|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
.|.|.| IT Consultant http://Geoff_Wass.com |.|.|.
Mervyn Bick
2008-11-27 05:43:20 UTC
Permalink
On Thu, 27 Nov 2008 05:55:32 +0200, Bruce R. Roland
Post by Bruce R. Roland
As I said the only explanation I can come up with is the concept of the
field value originally being a "NULL" and afterwards being not "NULL"
but an empty string instead.
I know it has been pointed out that an empty string is not a NULL in
several posts and this seems to be a very good example which shows that
difference.
I hope this helps you understand what I was trying to do and what I was getting.
Please note also my earlier post indicating my found solution to this
problem with respect to character fields in a table.
I'm not suggesting that you change anything seeing that you already have a
working solution but I'm posting this more for information than anything
else.

In the case of a character field, which is what you are using for your
dates, EMPTY() returns true for a null value or for "" or for " " in
the field. For a numeric field it would return true for a null value or
for 0. This means you could use the same structure for the canRender for
each field but with appriopriate picture clauses.


function TEXTDTC1_canRender
if empty(this.form.testdate1.rowset.fields["dtc"].value)
this.picture = " "
else
this.picture = "@R ##/##/##"
endif
return true


Mervyn.
Bruce R. Roland
2008-11-27 13:49:38 UTC
Permalink
Ivar

I tink to some degree you have answered both your own question and maybe mine. That is to say you are right about me using a character field to represent a date. Thus, from what you are saying your program would work differently then mine under the outlined circumstances and I thinkl tha is probably a big reeason for yours working to the end I would like and mine not.

I know there was a reason why I used a character field to represent a date rater than an actual date field. I don't recall exactly why now that I did that. It may have had more to do with personal preference - I don't know. Sounds like I will have to revist this some and see what happens.

As for your rxplanation as to what goes on and how the field changes once data has been entered and then erased, it seems to follow somewhat what I was saying but in a more accurate way. I guess I had somewhat a handle on what was going on albeit I did not know exactly. Your explanation of a string with the length "0" has helped me in my understanding.

Thnks

Bruce
unknown
2008-11-27 10:26:19 UTC
Permalink
On Wed, 26 Nov 2008 22:55:32 -0500 Bruce R. Roland
Sender: Bruce R. Roland <***@velocity.net>
wrote the following in:
Newsgroup: dbase.getting-started
Post by Bruce R. Roland
Ivar
Post by unknown
I have tried to follow this thread and found it difficult to understand what you are doing.
As I know nothing about reports I used the report wizard to create a report based on a table
containing a date field and a timestamp field, some of which are blank. When the report is displayed
on the screen the locations corresponding to the blank tablefields are also blank. Is that the kind
of result you are looking for?
You essentially have said what I am running into with just a little twist to it. The twist is that when I create a table all fields have a NULL value to begin with it seems. When I use a form to enter data into the table, obviously the fields into which I enter data no longer have a NULL value but now have the value entered (this sounds like I am stating the obvious - and I am for explanation purposes). For those fields which I do not enter a value - the value remains a NULL.
In the case of a date or time field for which nothing has been entered - the value is still a NULL. When I run the report
Please be precise, are you talking about the report I posted or some other report?
Post by Bruce R. Roland
what is displayed on screen at the locations corresponding to the "NULL" tablefields are blanks <emphasis added to it being a "NULL" fields which display as blanks>. This I believe from what you said is what you got as well - albeit you used the term "Blank" instead of "NULL" and as you read futher you will see - I believe - why I emphasize the difference between "NULL" and "Blank" here.
If a value is entered into - say - a date field
Again please be precise. Where is that datefield, in my report, in a form in your code, in your
table? How do you enter a value in it?
Post by Bruce R. Roland
- and hence the value became something other than the original "NULL" value - and then the date was later subsequently erased for whatever reason - the value of the field is no longer the date value entered (obvious since it was erased) nor is it the original NULL value - it is instead an EMPTY string value or in essence a "0" value.
That is not correct. A date field named fdate containing a null value is empty when tested with the
function EMPTY() and the command '? fDate = null' returns true. If a date value is entered in the
date field and subsequently erased, the date field is still empty when tested with the function
EMPTY() and the command '? fDate = null' returns true.

On the other hand, a character field named fChar containing a null value is empty when tested with
the function EMPTY() and the command '? fChar = null' returns true. If a character value is entered
in the date field and subsequently erased, the character field now contains a string of lenght zero.
The field is still empty when tested with the function EMPTY(), but the command '? fChar = null'
returns false, whereas '? fChar = ""' returns true.

See the OLH on EMPTY( ) for more details on various field types.

From your explanation it looks like you are using character fields to contain/represent date and
timestamp values. Why do that, when you could use date and timestamp fields which, as shown in my
example, works in a report as intended?


Ivar B. Jessen
Loading...