473,586 Members | 2,870 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem passing variables...

139 New Member
Hello,

Trying to export the results of a query into a spreadsheet, which I can do, but not as I like.

Procedure is this:

Form holds 2 date fields - ToDate, FromDate

query_CreateSho wTable.cfm shows the results as a table with all completed records within that date range. On the web page is a button with 'Export to Excel' on it. This exports the results to XLS format using the action query query_ExportToE xcel.cfm

I'm exporting to XLS by running this query, but it doesn't work as the query requires the values of ToDate & FromDate from my form.

How can I pass the values of ToDate & FromDate to the query _ExportToExcel. cfm?

Thanks
Neil
Oct 12 '10 #1
9 2689
acoder
16,027 Recognized Expert Moderator MVP
You can use something like:
Expand|Select|Wrap|Line Numbers
  1. exportToExcel.cfm?FromDate=#FromDate#&ToDate=#ToDate#
Oct 12 '10 #2
ndeeley
139 New Member
Hi acoder,

I've tried that, but it doesn't seem to be accepting the value of the ToDate.

Here's the links action:

Expand|Select|Wrap|Line Numbers
  1. <a href="action_CreateExcelReport.cfm?DateFrom=#DateFrom#&DateTo=#DateTo#" title="Export report to Excel .csv format" onMouseOver="window.status='Export report to Excel .csv format';return true;"><img src="assets/excel.png" /></a>
  2.  
and here's the handling script of the action_CreateEx celReport.cfm:

Expand|Select|Wrap|Line Numbers
  1. <cfquery datasource="taskbook" name="JobReport">
  2. select         ID,
  3.             CustomerName,
  4.             Dept,
  5.             Location,
  6.             ContactNo,
  7.             EmailAddress,
  8.             ChargeCode,
  9.             RequestDate,
  10.             TaskTypeFK,
  11.             TaskDetails,
  12.             JobStatusFK
  13. from        tblTaskBooker    
  14. where        ChargeableYN = 1 and JobStatusFK like 'Completed'
  15.             and ((RequestDate BETWEEN #DateFrom# AND #DateTo#) or (RequestDate Is Null))
  16. order by    CompletionDate
  17. </cfquery>
  18.  
Anything I am doing wrong here?
Oct 13 '10 #3
acoder
16,027 Recognized Expert Moderator MVP
Yes, when passed to the page via the URL, they can be accessed as #url.DateFrom# and #url.DateTo#.
Oct 13 '10 #4
ndeeley
139 New Member
Thanks, I have changed that, but now I`m getting this error:

Parameter 1 of function CreateODBCDate which is now "" must be a date/time value

It's not passing the value for some reason.I've tried outputting it at the top of the page but its empty.
Oct 13 '10 #5
acoder
16,027 Recognized Expert Moderator MVP
What's the value in the URL? Are you seeing "action_CreateE xcelReport.cfm? DateFrom=&DateT o=" in the address bar? If so, you need to check the values before they're passed on the CreateShowTable .cfm page.
Oct 13 '10 #6
ndeeley
139 New Member
Sort of...what I am seeing is this:

http://marlin/assetinl/scripts/TaskB...e&DateTo=tdate

I'm creating two variables to hold the dates:

Expand|Select|Wrap|Line Numbers
  1. <cfset fdate = '#form.QuickRpts_DateFrom#'>
  2. <cfset tdate = '#form.QuickRpts_DateTo#'>
  3.  
Then passing those variables along the url string:
Expand|Select|Wrap|Line Numbers
  1. <a href="action_CreateExcelReport.cfm?DateFrom=#fdate#&DateTo=#tdate#" title="Export report to Excel .csv format" onMouseOver="window.status='Export report to Excel .csv format';return true;"><img src="assets/excel.png" /></a>
  2.  
and I have outputted the values at the bottom of the page (ie the one with the export to excel button on it) and it is showing the correct date values:

Expand|Select|Wrap|Line Numbers
  1. <cfoutput>
  2. #fdate# <br />
  3. #tdate#
  4. </cfoutput>
  5.  
of
01/09/2010
01/10/2010

so I have no idea where I am going wrong!
Thanks for your help!
Neil
Oct 13 '10 #7
acoder
16,027 Recognized Expert Moderator MVP
Ah right. The URL should of course be in <cfoutput> tags otherwise it'll just be a string #fdate# instead of the actual value of the variable.
Oct 13 '10 #8
ndeeley
139 New Member
Brilliant - got it all to work!

Thanks for all your help.

Cheers
Neil
Oct 13 '10 #9
acoder
16,027 Recognized Expert Moderator MVP
No problem. Glad to :)
Oct 13 '10 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2190
by: lawrence | last post by:
Those of you with backgrounds with the C language will laugh at my mistake, but those of you, like myself, who deal mostly with PHP should be warned about passing variables as references - debugging then requires a whole new mindset. I've a cms written in procedural style that I've been converting to OOP. It is important to always pass...
7
10691
by: Matthew Robinson | last post by:
i read a tutorial the other day on passing variables between php pages using a html form and setting the action to the php page to parse, can anybody see anything wrong with the code below? the problem is, that the page always loads the html form, and i cant work out why this is so, even after i select a catagory from the drop down list and...
2
1909
by: Chieko Kuroda | last post by:
Hello all, I would like to learn the syntax for passing variables that I retreived from a database to a second asp page. Currently, I'm using: Response.Write "<tr><td>&nbsp;</td><td><Font size= ""-1""><B><a href= ""InterviewerInfo2.asp?timeID=" & rs("Starttime") & " "">" How do I add more variables to my link: <a href = ...? ie...
1
3604
by: Consuelo Guenther | last post by:
Hello, I am having problems with passing variables between pages. I have the following: First asp page has the function: ----------------------------------------------------------------------- <script language="JavaScript"> function addProcess(addPName,addSProcess,addPIndex) { var addProcessWindow =...
6
3246
by: Scott Zabolotzky | last post by:
I'm trying to pass a custom object back and forth between forms. This custom object is pulled into the app using an external reference to an assembly DLL that was given to me by a co-worker. A query-string flag is used to indicate to the page whether it should instantiate a new instance of the object or access an existing instance from the...
7
2775
by: Khai | last post by:
First off, yes, I understand the crapload of tutorials out there, (well, rather, I understand there /are/ a crapload of tutorials out there), the problem is my comprehension. I'm trying to pass variables, and can do so just fine with a URL, and $_GET. What I would like to learn, and be very adept at using is the Form functions and how you...
1
1277
by: Rotsen | last post by:
HI people, I am trying to read a file using "file" and I am passing the following string for the input file parameter: http://maggie.sdcwa.org/eng/list/client_find_project_list.phtml?proj_name=CATHODIC PROTECTION OF RAMONA PIPELINE PHASE 2&show=1 phpinfo shows: _GET CATHODIC
3
2112
by: jsdeveloper | last post by:
Hi, I just started programming in javascript, and I'm having a problem passing variables between javascript and asp code in .asp page. Can you please help? I've given the sample code below. ---------------------------------------------------------------------------------- <script src="http://www.aurumtech.com/domain_str.js" ...
6
3295
by: coool | last post by:
Hi :) anyone knows how can I send variables from a php page to a form - i need to fill the form with these variables ? maybe using (the process of passing variables to other pages - through url) but how can i assign them to form variables ?
6
2189
BezerkRogue
by: BezerkRogue | last post by:
This is the most fundamental action I am sure, but I can't seem to make it happen. I am familiar with passing variables in ASP. But that doesn't seem to be the preferred method in .NET. I have some scripts that run at the server for the form so I can't disable that statement. I followed Microsoft's instructions(I know..not the best thing to...
0
7911
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8200
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8215
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3836
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1448
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1179
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.