Page Index Toggle Pages: [1] 2  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) CHANGING REPORTS ON THE FLY (Read 4157 times)
Louis Galvao
Full Member
***
Offline


"Sufferin' Succatash"

Posts: 265
Location: Canada
Joined: Feb 14th, 2005
CHANGING REPORTS ON THE FLY
Mar 8th, 2005 at 9:49pm
Print Post Print Post  
It seems that a huge difference between Q&A and Sesame is that in Q&A, you could easily change the design of a report on the fly whereas in Sesame, you must hard code the report with specific fields or with unbound fields.

For instance, we have a master report in Q&A that is set up to generate a performance summary for a particular month.  The fields selected are not date fields but rather number fields.  In Q&A, we change the temporary design to select the fields pertaining to the relevant month.

It appears in Sesame that I have to hard code the report for each month resulting in 12 reports.  This is very time consuming, even though I do copy the report layout and modify it.  There's no guess work for the users but it creates long term maintenance issues in terms of modifying reports.

I started trying to program some of the unbound fields but wasn't getting the result I wanted.

Do you see another opportunity in dealing with this ?

Thanks,

Louis

  

Louis Galvao
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: CHANGING REPORTS ON THE FLY
Reply #1 - Mar 8th, 2005 at 10:07pm
Print Post Print Post  
Sesame is extremely flexible about changing reports on the fly. You just don't do it by editing the actual report design every time you want to run the report. If you get Inside Sesame, I wrote an article on this subject a couple issues ago.

I believe you can do what you are asking with unbound value boxes. Give me a couple days and I'll try to build you a sample app when I get a few minutes. Unless somebody beats me to it.  Grin

I'm assuming you have twelve sets of elements on your Form. One set for each month?
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Louis Galvao
Full Member
***
Offline


"Sufferin' Succatash"

Posts: 265
Location: Canada
Joined: Feb 14th, 2005
Re: CHANGING REPORTS ON THE FLY
Reply #2 - Mar 8th, 2005 at 11:20pm
Print Post Print Post  
The form is setup with a section of rows and columns as per this example:

Month | Field1| Field2| Field3|, etc

JAN     |
FEB     |
MAR    |
etc.

For Jan, I would pick up all the fields across the row.  Same for Feb thru Dec.

If there is way to program the unbound fields to capture this info, it would be a big timesaver.

Thanks

Louis
  

Louis Galvao
Back to top
 
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: CHANGING REPORTS ON THE FLY
Reply #3 - Mar 9th, 2005 at 1:02am
Print Post Print Post  
Here's one approach to consider:

NOTE: All code here is off the cuff, untested, may need some tweaking).

To get this month, in your Retreive Spec use something like this:
@MONTH(XACTDATE)=@MONTH(@DATE) AND @YEAR(XACTDATE)=@YEAR(@DATE)


To get last month: @MONTH(XACTDATE)=@MONTH(@DATE)-1 AND @YEAR(XACTDATE)=@YEAR(@DATE)

----------------------------------------
Use this to get any previous month/year by entering the number of previous months/years to go back into a pair of variables.
var vMonthOffset as INT
var vYearOffset as INT

vMonthOffset = 0
vYearOffset = 0

@MONTH(XACTDATE)=@MONTH(@DATE)--vMonthOffset AND @YEAR(XACTDATE)=@YEAR(@DATE)--vYearOffset

So if I want to see XACTIONS in January, today, March 8, I would set  vMonthOffset=2.
To see Feb 2004, set vMonthOffset=1, and vYearOffset=1

(Use a negative offset to get future months in this year)
---------------------------------
You could make this more user frinedly by prompting for the month wanted and letting your programming convert the month/year entered into the correct offsets.  In any case you still only need one report.  Use an offset of 0 to run the current month details.
--------------

  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: CHANGING REPORTS ON THE FLY
Reply #4 - Mar 9th, 2005 at 1:19am
Print Post Print Post  
For LEs that hold numbers for a particular period, try this:

Suppose you had End Of Month balances for every month for every year on a form with the current balance in the LE for the current MY.

LE names should be formatted to include "F" as a prefix, a number for month and last 2 digits for year. Like this:

Jan/2005 = F105
Feb/2005 = F205
Sep/2006 = F906
Dec/2007 = F1207

Make the Report element have a formula to call the spedific LE by using @FIELD(), something like this:

var vMonthOffset as INT
vMonthOffset=0

@FIELD("F" + @STR(@MONTH(@DATE)-vMonthOffset) + @STR(@MID(@DATE,3,2)) )

------------------------------------------
What this does is actually brings up a different LE value; each month bringing up the current LE name (FMYY), but could bring up LEs from other months by changing an Offset value.  Add a suffix (A,B,C?) for each additional field across the form to take care of your three fields.  Put the diffeent formula in each of the three unbound fields on the report.
-----------------------------------
Per my previous posting you could make more complex with variables for offsetting the year, you could provide prompts and them converted into an offset value.

Note again: code above is untested using techniques I have used in Q&A over past years.  In Q&A I made a Derived Column for the Offset value.  So, when making TEMP changes to a report, only had to change the single offset value in the Derived Column section.
« Last Edit: Mar 9th, 2005 at 3:30am by Bob_Hansen »  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: CHANGING REPORTS ON THE FLY
Reply #5 - Mar 9th, 2005 at 1:49am
Print Post Print Post  
OK, here's a sample. You can download the app at:
http://www.hammerdata.com/Misc/month_report.zip

I made a Form with a set of elements as you describe:



I made a report that includes all the elements from the Form, but set to be invisible. I then added three unbound visible elements.

A command button on the Form asks the user to select a Month, sets a GlobalValue the Report can see, then runs the Report.
Code
Select All
var vMonth as String
var vRun as Int

vMonth = @PopupMenu("01-Jan;02-Feb;03-Mar;04-Apr;05-May;06-Jun;07-Jul;08-Aug;09-Sep;10-Oct;11-Nov;12-Dec", "Select A Month")
If @Len(vMonth) = 0
{
	vMonth = "Jan"
}
Else
{
	vMonth = @Right(vMonth, 3)
}
GlobalValue("ReportMonth", vMonth)

vRun = @SelectTreeItem("Search Update Menu!Results Commands!Reports!Demo!DemoReport (Preview)")
 



The Report uses the selected Month to pick which values to display. The rest remain hidden.

Code
Select All
GLOBAL CODE
stat sMonth as String

sMonth = @GlobalValue("ReportMonth") 



Code
Select All
LE36::OnPrint
If sMonth = "Jan"
{
	LE36 = LE0
	LE37 = LE1
	LE38 = LE2
}
Else If sMonth = "Feb"
{
	LE36 = LE3
	LE37 = LE4
	LE38 = LE5
}
Else If sMonth = "Mar"
{
	LE36 = LE6
	LE37 = LE7
	LE38 = LE8
}
Else If sMonth = "Apr"
{
	LE36 = LE9
	LE37 = LE10
	LE38 = LE11
}
Else If sMonth = "May"
{
	LE36 = LE12
	LE37 = LE13
	LE38 = LE14
}
Else If sMonth = "Jun"
{
	LE36 = LE15
	LE37 = LE16
	LE38 = LE17
}
Else If sMonth = "Jul"
{
	LE36 = LE18
	LE37 = LE19
	LE38 = LE20
}
Else If sMonth = "Aug"
{
	LE36 = LE21
	LE37 = LE22
	LE38 = LE23
}
Else If sMonth = "Sep"
{
	LE36 = LE24
	LE37 = LE25
	LE38 = LE26
}
Else If sMonth = "Oct"
{
	LE36 = LE27
	LE37 = LE28
	LE38 = LE29
}
Else If sMonth = "Nov"
{
	LE36 = LE30
	LE37 = LE31
	LE38 = LE32
}
Else If sMonth = "Dec"
{
	LE36 = LE33
	LE37 = LE34
	LE38 = LE35
}
 



This produces a different report depending on which Month is selected.


This gets you any month you want with only one report. The user doesn't need to muck with the report design to run the report. They just pick the month, and the report itself handles the rest.

BTW, keep an eye out for a future release that will allow you to embed the Popup Menu right in the Report itself so you don't need the command button!  Wink

I hope this helps!  Smiley
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Louis Galvao
Full Member
***
Offline


"Sufferin' Succatash"

Posts: 265
Location: Canada
Joined: Feb 14th, 2005
Re: CHANGING REPORTS ON THE FLY
Reply #6 - Apr 5th, 2005 at 6:25pm
Print Post Print Post  
Seems like forever since you sent me your response.  With holidays, a busy work schedule, trying to absorb your example and a little bit of procrastination, I have not been able to implement your fine example.

I read with interest your comment about embedding the Pop Up menu right int the report - this would definitely be preferable and I look forward to this in a future release.  Any idea when ?

In the meantime, within the same spreadsheet, I have another section setup similarly.  This would mean two command buttons in the database.  Is this feasible ?

Thanks,

Louis
  

Louis Galvao
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: CHANGING REPORTS ON THE FLY
Reply #7 - Apr 5th, 2005 at 7:20pm
Print Post Print Post  
Quote:
I read with interest your comment about embedding the Pop Up menu right int the report - this would definitely be preferable and I look forward to this in a future release.  Any idea when ?


I don't have a specific date.

Quote:
In the meantime, within the same spreadsheet, I have another section setup similarly.  This would mean two command buttons in the database.  Is this feasible ?


Of course. You can have as many command buttons as you want.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Louis Galvao
Full Member
***
Offline


"Sufferin' Succatash"

Posts: 265
Location: Canada
Joined: Feb 14th, 2005
Re: CHANGING REPORTS ON THE FLY
Reply #8 - Apr 7th, 2005 at 5:32pm
Print Post Print Post  
I was able to incorporate your demo into my database with some minor modifications and it worked like a charm !

It looks like I will need about 6 command buttons to deal with different reports, so I have set up a "Command Centre" on my database to keep all the buttons in one central place.

I went through the same steps to create another command button and report, and I am having a problem with the program as it does not recognize "sMonth".  It is able to run the report utilizing the popup menu but the the first key number field is not coming up with any value for any month.

It appears I have mapped the LE's correctly to pick up the values.  I have placed reference to sMonth in the title also, and it does not recognize.  Would any of the programming have to change in the command button other than report name or in the Global Code ?

Any suggestions would help.  In the meantime I will keep reviewing.

Thanks,

Louis
  

Louis Galvao
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: CHANGING REPORTS ON THE FLY
Reply #9 - Apr 7th, 2005 at 7:02pm
Print Post Print Post  
The following line must appear in the GLOBAL CODE area of the Report:

stat sMonth as String

This declares the sMonth variable so it can be used in code. When you test your report code, do you get a compile error?
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Louis Galvao
Full Member
***
Offline


"Sufferin' Succatash"

Posts: 265
Location: Canada
Joined: Feb 14th, 2005
Re: CHANGING REPORTS ON THE FLY
Reply #10 - Apr 7th, 2005 at 7:25pm
Print Post Print Post  
This is what I have in my Global Code:

stat sMonth as string

sMonth = @Globalvalue("Reportmonth")

This is the exact coding that I placed in my first report which worked.

I do not get any errors in my progrma when I test it.

I do, however, receive a warning as the report layout element name has a     /     in it.

Thanks,

Louis
  

Louis Galvao
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: CHANGING REPORTS ON THE FLY
Reply #11 - Apr 7th, 2005 at 7:33pm
Print Post Print Post  
Is the command button whcih runs the report setting the GlobalValue with something like the line below?

GlobalValue("ReportMonth", vMonth)
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Louis Galvao
Full Member
***
Offline


"Sufferin' Succatash"

Posts: 265
Location: Canada
Joined: Feb 14th, 2005
Re: CHANGING REPORTS ON THE FLY
Reply #12 - Apr 7th, 2005 at 9:29pm
Print Post Print Post  
The command button has this statement in it.

I continued on and created a new report and it worked just fine.

The difference between the two reports that work and the one that doesn't is that there are more than one variable in the functional ones and only one variable in the the non-functional one.  Meaning, I only had to reference one field as per this sample:

IF sMonth = "JAN"
{
     LE61 = LE1
}
ELSE IF sMonth = "FEB"
{
     LE61 = LE12
}            


Does this make any difference ?

Thanks,

Louis



  

Louis Galvao
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: CHANGING REPORTS ON THE FLY
Reply #13 - Apr 7th, 2005 at 10:11pm
Print Post Print Post  
Quote:
Does this make any difference ?


No. There is something else different.

When it doesn't work, what does it do?
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Louis Galvao
Full Member
***
Offline


"Sufferin' Succatash"

Posts: 265
Location: Canada
Joined: Feb 14th, 2005
Re: CHANGING REPORTS ON THE FLY
Reply #14 - Apr 8th, 2005 at 12:42pm
Print Post Print Post  
Good morning. 
It goes through all the motions and prints the report to HTML but does not pick up the required data for the COMM field nor the sMonth at the top of the report.

I think comes down to the programming not recognizing the sMonth.

I am going to try and re-create this one from scratch.  I am sure that it is just a minor mis-statement in my programming. 

Thanks,

Louis

Thanks,

Louis
  

Louis Galvao
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send Topic Send Topic Print Print