Hot Topic (More than 10 Replies) Report question (Read 1615 times)
Derek-PSTC
Member
Members
*
Offline


No personal text

Posts: 12
Joined: May 3rd, 2006
Report question
May 3rd, 2006 at 11:51pm
Print Post Print Post  
I have a problem client and have the following question.

Can I use a command button and list box to to populate the retrive specs on a report.

This would save me making multiple reports to deal with his different needs.

Application is trucking company, with multiple divisons, and multiple terminals.

Example of required spec for say a list of drivers would be,

Pick Drivers list report, choose division, choose terminal.

Any help would be greatly appreciated.
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Report question
Reply #1 - May 4th, 2006 at 11:44am
Print Post Print Post  
Quote:
I have a problem client and have the following question.

Can I use a command button and list box to to populate the retrive specs on a report.

Yes. The easiest way would be to use "On Retrieve Spec Open" programming on the form in question. Though it can also be done by building another form bound to the same database that uses a combination of unbound lists and buttons and invisible bound elements.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Report question
Reply #2 - May 4th, 2006 at 11:49am
Print Post Print Post  
I've also seen people take a route where they put a button on their form. When the user clicks, a list of reports is offered. When a report is selected, a list of retrieves is offered.  When a Retreive is selected, the records are retreived and the report is run.

Look into the following commands:
@SelectTreeItem
@LoadRetreiveSpec
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Derek-PSTC
Member
Members
*
Offline


No personal text

Posts: 12
Joined: May 3rd, 2006
Re: Report question
Reply #3 - May 11th, 2006 at 12:40am
Print Post Print Post  
Ok thank you for the help,

My button is working fine, but I am still having a problem passing the extra info I need for the retrieves into the report.

Edit to tell you I'm using a seperate popup box to get that info that I'm trying to pass to the @loadretrievespec

I don't want to have to make seperate reports for each spec I need

4 companies, 30 terminals etc

Am Stumped

Thank you

Derek
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Report question
Reply #4 - May 11th, 2006 at 11:45am
Print Post Print Post  
Derek,

If you have that many combinations, you don't want to do it with a pile of saved retrieve specs. You can use the On Retrieve Spec Open event to fill out the Retrieve Spec with whatever the user picks. I'll ask Ray to post an example for you.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Derek-PSTC
Member
Members
*
Offline


No personal text

Posts: 12
Joined: May 3rd, 2006
Re: Report question
Reply #5 - May 11th, 2006 at 3:57pm
Print Post Print Post  
Thank you!
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Report question
Reply #6 - May 11th, 2006 at 4:35pm
Print Post Print Post  
Hello Derek,

Below is code that will get attached to a command button. When clicked on the retrieve spec it will display two lists, one for Divisions and one for Terminals. After both choices are made, the records are retrieved and the report is run.

Code
Select All
Var vDivision as String
Var vTerminal as String
Var vSuccess as Int

If @Mode() = 2 Then
{
	//Code will only work in Search Mode

	//Bring up two menus for the user to choose the division and terminal
	vDivision = @PopupMenu("Division A;Division B;Division C;Division D", "Please Choose a Division")
	vTerminal = @PopupMenu("Terminal 1;Terminal 2;Terminal 3;Terminal 4;Terminal 5", "Please Choose as Terminal")

	If ((vDivision <> "") And (vTerminal <> "")) Then
	{
		//If a choice was made from both menus. You can change this.

		DivisionElement = vDivision
		TerminalElement = vTerminal

		//Retrieve the results
		vSuccess = @SelectTreeItem("Search Menu!Search Commands!Retrieve New Results (F10)")
		If Not @Mode() = 2
		{
			//If records were found that matched the retrieve spec

			//Run Drivers List Report
			vSuccess = @SelectTreeItem("Search Update Menu!Results Commands!Reports!Database Name!Drivers List (Preview)")
		}
	}
} 



Say Hello to Peter for me.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Derek-PSTC
Member
Members
*
Offline


No personal text

Posts: 12
Joined: May 3rd, 2006
Re: Report question
Reply #7 - May 11th, 2006 at 6:10pm
Print Post Print Post  
Thank you so much Ray!

Will try it out tonight and have a go at it.

This is my first major programming problem and it was stumping me totally.

Again thanks

Derek

P.S.  Will say hello to Peter for you as soon as he gets back from holiday's,,, hopefully in September

lol
  
Back to top
 
IP Logged
 
Derek-PSTC
Member
Members
*
Offline


No personal text

Posts: 12
Joined: May 3rd, 2006
Re: Report question
Reply #8 - Jun 1st, 2006 at 5:58pm
Print Post Print Post  
Ray,

Sorry but having one issue.

If I include the statement   Terminated = "=" to  meaning Terminated is not blank to exlude the terminated drivers from my retrieve specs in the programing, it translates that statement  into 0000/00/00

Terminated field is a date field.

In a sample database, if I include the terminated = "=" on the attched retrieve on the report it works, but in this client's database it dosn't.

Pulling what little hair I have left out!

Thanks again, you sample code worked wonders but this addition by me is frustrating.

Derek
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Report question
Reply #9 - Jun 1st, 2006 at 6:18pm
Print Post Print Post  
Hello Derek,

You will need to use FormFieldValue to fill in the retrieve spec in code. An example of this is

Code
Select All
FormFieldValue("FormName", "Terminated", -1, "=") 



You will need to replace FormName with the name of your form and you should be good to go.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Derek-PSTC
Member
Members
*
Offline


No personal text

Posts: 12
Joined: May 3rd, 2006
Re: Report question
Reply #10 - Jun 1st, 2006 at 7:00pm
Print Post Print Post  
thank you thank you


Smiley
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Report question
Reply #11 - Jun 1st, 2006 at 7:07pm
Print Post Print Post  
You're welcome Derek.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged