Best practice for adding constant (but soft) data to a report

46 views
Skip to first unread message

David Knight

unread,
May 25, 2012, 12:01:22 AM5/25/12
to designba...@googlegroups.com
Hello to the group,
I am using dbv6 on d3/2win; but vaguely remember having the same issue when in UV. I have an SB+ background, which tends to 'colour' my point of view - I apologise!
 
I am now designing a multitude of reports for my re-worked system; and on the header of each report I want to put the customer's business name, but not as an image [I have that elsewhere]. In my app I have those details stored in a single file called HMCONTROL with item-id of CONTROL; and amc1 contains the business name. I simply want to 'plonk' that data into the header of each report. Not as simple as I had thought, though in db.
 
This is the approach I have taken:
 
1. Create a field on HMCONTROL called NAME which points to amc1.
2. Build a small subroutine called LOAD.COMPANY.PRG which simply reads HMCONTROL, CONTROL into DBOTHER.RECORD(20). Here is the code fragment, which I have debugged & know runs:

*

OPEN '',"HMCONTROL" TO HMCONTROL ELSE

     RETURN

END

*

READ DBOTHER.RECORD(20) FROM HMCONTROL,"CONTROL" ELSE

     DBOTHER.RECORD(20) = ""

END

Simple, right?
 
3. I then placed the HMCONTROL field NAME into the header, and modified its properties so it refers to DBOTHER.RECORD(20). Thus it should display amc1 of DBOTHER.RECORD(20).
4. All that remains is to get db to run the routine once per report to load up DBOTHER.RECORD(20). This proved to be quite hard to do:
   4a. I tried the slot "Process before Display" which seemed the logical spot. It would run, but nothing appears on the report in the header. I am assuming that since db is still doing all the reads after this process, it nulls DBRECORD and [presumably] all the DBOTHER.RECORD(n) entries. This spot seemed logical since it would occur only once. Nice and efficient.
  4b. I tried putting the same routine in the 'Derived in Subroutine' slot of the field on the header expecting db to execute the routine and thus populate DBOTHER.RECORD(20) whenever the header bit was processed. Nope. It doesn't run the routine, which I found strange.
  4c. I tried putting a 'dummy' field off to the right of the report but above the row where my field was, and this dummy field had my subroutine in the 'Derived in Subroutine' slot. Nope, that didn;t work either. Perhaps for the same reason as 4b?
  4d. Finally I tried putting it in the Report's 'Report Read Process' slot; which is run for each and every record that is read. Bingo; it now works; but I have to say this is massive overkill just to get a single read done. Every read on the report now requires this record to be rebuilt? Come on, that's a bit inefficient, innit?? Further, it means that for more complex reports where I probably WILL want to use this slot; I shall have to remember to include my subroutine; which is pain.
 
I would have thought there is an easier/better way to do something simple like this?
 
Can anyone tell me what they do? Suggestions?
 
Thank you in advance.
 
David

David Knight

unread,
May 25, 2012, 6:48:25 AM5/25/12
to designba...@googlegroups.com
Just to add a further note to this method: because the data only gets loaded into DBOTHER.RECORD(20) after a read; if the report selection produces a report with 'No items to report'; then there was no read; and ergo no load. Which means the report itself doesn't have the client's name on the top like a report with data should. Minor point, since one could argue that an empty report is useless; but it highlights: (a) the need to do this load ONCE at the beginning of the report; and (b) There MUST be a better way than the way I am doing it now!!
 
David

Barry Rutherford

unread,
May 25, 2012, 11:51:36 AM5/25/12
to designba...@googlegroups.com
I have question for the group.   Right now we have a button on a DesignBais form that a user can click that calls a subroutine that sets DBCALLURL to launch a new web session that runs an ASP page.  We need to be able to put a control on the form and have that control launch the ASP page within the DesignBais form.  Has anyone done that?  Can it be done?  If so, how do we go about doing it?  I tried not using the “newWindow” property and the entire DesignBais form gets replaced by the ASP page we’re launching – so that’s no good to us either.  We only want a section (frame) of the DesignBais form to navigate to the new web page while still leaving the rest of the form in place and accessible to the user.

Tony Gravagno

unread,
May 25, 2012, 2:34:23 PM5/25/12
to designba...@googlegroups.com

Barry, I think you'd be interested in this blog that I wrote on the topic:

http://nebula-rnd.com/blog/general/2006/07/dbscript1.html

It was based on a document by Symeon Breen for doing file uploads from a DB page -  see blog for link.

That technique was then used for adding scripts, a "rich text" editor, different charting components, mashups, third-party controls (gauges, grids, Silverlight, Java, Flash), and other functionality beyond what DesignBais has built into the box. See my other blogs in the DesignBais category for ideas and details.

 

DesignBais International advertises and sells their product as a complete solution. I prefer to think of it as a solid base to start, but more of a framework which can be used to take an excellent application to "the next level" for application providers who wish to do so. The difference in the view is that I believe we should do what is possible with this product, when it makes business sense, rather than accepting that we shouldn't want more than what seems to be in front of us.

 

HTH

Tony Gravagno

Nebula Research and Development

TG@ remove.pleaseNebula-RnD.com

Nebula-RnD.com/blog

Visit http://PickWiki.com! Contribute!

http://Twitter.com/TonyGravagno

http://groups.google.com/group/mvdbms/about

David Knight

unread,
May 26, 2012, 7:51:13 PM5/26/12
to designba...@googlegroups.com
Seriously?? No-one come across this issue? Or am I that dumb that I cannot see an obvious answer?? No responses? Anyone....?
 
 

On Friday, May 25, 2012 2:01:22 PM UTC+10, David Knight wrote:

Tony Gravagno

unread,
May 26, 2012, 9:10:56 PM5/26/12
to designba...@googlegroups.com

You posted on a Friday before a major USA holiday (3-4 day weekend).

Give the world a little time to catch up with you. :)

 

 

From: David Knight

 

Seriously?? No-one come across this issue? Or am I that dumb that I cannot see an obvious answer?? No responses? Anyone....?

 

 


On Friday, May 25, 2012 2:01:22 PM UTC+10, David Knight wrote:

Hello to the group

 

David Knight

unread,
May 26, 2012, 9:29:43 PM5/26/12
to designba...@googlegroups.com
Hi Tony,
Thanks. Didn't know.... Sorry everyone!!
 
Guess the world doesn't run to my timetable! ;>)
 
Cheers
 
David.

Bulent Can

unread,
May 27, 2012, 7:03:27 PM5/27/12
to designba...@googlegroups.com

David  

The place in designbais that is designed to run once per report is  PROCESS.EVENT = “BEFORE REPORT”

We use this slot to change the image used on all our reports from a generic image to a client specific image 

*-------------------------------------------------------------------

BEFORE.REPORT:

*

   OLD.IMAGE='BAIMAGES\BAWEBLOGO.GIF'

   CALL DB.G.IMAGESPEC(OLD.IMAGE,NEW.IMAGE

Andrew Morris

Designbais

--
You received this message because you are subscribed to the Google Groups "DesignBais-Forum" group.
To view this discussion on the web visit https://groups.google.com/d/msg/designbais-forum/-/q3CKyA1vg1kJ.
To post to this group, send email to designba...@googlegroups.com.
To unsubscribe from this group, send email to designbais-for...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/designbais-forum?hl=en.

David Knight

unread,
May 27, 2012, 7:44:42 PM5/27/12
to designba...@googlegroups.com
Hi Andrew,
Thank you for the reply.
 
That was the process slot I was trying to use firstly. But it seems that DBOTHER.RECORD(20) gets nulled before it has chance to appear. Given that in the Report designer, field properties I can choose from the following 'files' to reference: DBRECORD [can't use that as it is used to read each line of the report]; DBWORK [had trouble with that in the past being nulled as well]; or one of the DBOTHER.RECORD(n) entries. I assigned DBOTHER.RECORD(20) for this purpose and plan to use it across my app.
 
In my code I am not using the large CASE structure for this function, it is more like a codeblock; so I do not need a 'section' called "BEFORE REPORT" I just have to put the routine catalogued name in the report designer's design slot that relates to the "BEFORE REPORT" concept. That I did, but it does not work. Or rather, I suspect it does but before my field can reference it DBOTHER.RECORD(n) are nulled. So, how does one do this in practice, without having to do this repeatedly per read??
 
This is easy to test for yourself. Just have a small code fragment that reads a known record which contains some text and then try to display one attribute of that text in the header of a report. You will see what I mean.
 
Cheers!
To post to this group, send email to designbais-forum@googlegroups.com.
To unsubscribe from this group, send email to designbais-forum+unsubscribe@googlegroups.com.

Andrew Morris

unread,
May 27, 2012, 9:36:35 PM5/27/12
to designba...@googlegroups.com

David

 

You can use the BEFORE REPORT and put the required data into BKWORK as this should not be nulled on each read otherwise you could put the data into DBSTORE(X) and move to DBOTHER.RECORD(X) on after read

 

 

Andrew

 

From: designba...@googlegroups.com [mailto:designba...@googlegroups.com] On Behalf Of David Knight
Sent: Monday, 28 May 2012 9:45 AM
To: designba...@googlegroups.com
Subject: Re: Best practice for adding constant (but soft) data to a report

 

Hi Andrew,

To post to this group, send email to designba...@googlegroups.com.
To unsubscribe from this group, send email to designbais-for...@googlegroups.com.


For more options, visit this group at http://groups.google.com/group/designbais-forum?hl=en.

--

You received this message because you are subscribed to the Google Groups "DesignBais-Forum" group.

To view this discussion on the web visit https://groups.google.com/d/msg/designbais-forum/-/O_xMSdeGc2MJ.
To post to this group, send email to designba...@googlegroups.com.
To unsubscribe from this group, send email to designbais-for...@googlegroups.com.


For more options, visit this group at http://groups.google.com/group/designbais-forum?hl=en.

This message may contain privileged or confidential information and is intended only for the individual named. If you are not the named addressee you should not disclose, disseminate, distribute or copy this e-mail. If you have received this e-mail by mistake please notify the sender immediately by e-mail and delete this e-mail from your system. You should rely on your own virus checking programs and procedures for checking any attachments. Please advise us if you wish your name and e-mail address to be removed from our database.

David Knight

unread,
May 28, 2012, 3:08:50 AM5/28/12
to designba...@googlegroups.com
Hi Andrew,
Of course I think you mean DBWORK not BKWORK?
 
I'll certainly give this a try, but I had problems some years back with DBWORK because db also wants to use it; and was nulling DBWORK from time to time. An example of db using DBWORK can even be found in the manual. See p74. Lookup file facility I believe uses DBWORK to create those neat drop-down lists. It was in this regard that I knew there were issues 'playing' around with DBWORK. I forget exactly but it shall come to light again soon because I am going to be working on that section of my app again real soon.
 
Anyway, as I said, I'll give it a go and post the outcome here.
 
Meanwhile, perhaps as an enhancement request: Why can't we reference DBSTORE(n) just like we can DBRECORD, DBOTHER.RECORD(n) or DBWORK? DBSTORE(n) is [I believe] a completely 'hands off' area for db: Only initialised at the start & then left up to the application to do whatever it wants.
 
I doubt that would be a hard change to db?
 
Then I could simply load up DBSTORE perhaps once at login time; and then simply refer to it on a form via the properties of a field on the form/report?
 
Wouldn't that be neat?
 
Cheers!
 
David

To post to this group, send email to designbais-forum@googlegroups.com.
To unsubscribe from this group, send email to designbais-forum+unsubscribe@googlegroups.com.


For more options, visit this group at http://groups.google.com/group/designbais-forum?hl=en.

--
You received this message because you are subscribed to the Google Groups "DesignBais-Forum" group.
To view this discussion on the web visit https://groups.google.com/d/msg/designbais-forum/-/O_xMSdeGc2MJ.

To post to this group, send email to designbais-forum@googlegroups.com.
To unsubscribe from this group, send email to designbais-forum+unsubscribe@googlegroups.com.


For more options, visit this group at http://groups.google.com/group/designbais-forum?hl=en.

Rick Weiser

unread,
May 29, 2012, 7:40:03 AM5/29/12
to designba...@googlegroups.com
David,

Yes, you want to load a field of DBWORK with the client name.

Yes, you want to use DBSTORE to hold this data.  You can load DBSTORE at the time the user logs in with all pertinent client information thus negating the need to read it again and again.  Normally, this is done in the "Process before Display" of the start-up form for the user.  Then in the "Before Report" of each report, you would set your DBWORK<xx> = DBSTORE(xx)<xx,xx>.

Also, if you want to display the image of the client in the header, place a default image in the header.  When first placing an image on the form, DB uses "DBLOGO.JPG".  So, in your "Before Report" you could do the following:

DBIMAGESPEC<1> = "DBLOGO.JPG"     <-----  Image you are changing
DBIMAGESPEC<2> = "myimage"             <-----  Image you are changing it to.  Note: the path to this file is relative to the Images directory in your website.

I hope this helps,

Rick

Barry Rutherford

unread,
May 30, 2012, 12:44:41 PM5/30/12
to designba...@googlegroups.com
Thanks Tony, that worked for us.  It was easier than we realized.
 
--
You received this message because you are subscribed to the Google Groups "DesignBais-Forum" group.
To post to this group, send email to designba...@googlegroups.com.
To unsubscribe from this group, send email to designbais-for...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages