Parsing List in URL Variable for Query
Hi, I am sending a url variable as in the following example:
http://mypage.com/lookup.cfm?var=1001,1002,1003
I then need to query a database given the string
"1001,1002,1003" in #URL.VAR# to find all records that contain
those RecID numbers in my table. Has anyone done this before, and
if so what is the best way to accomplish this?
Thanks!
i tried using the following code, but keep getting an error:
<cfif listLen(url.var) neq 0>
<cfquery name="lookup" datasource="#application.dsn#">
select *
from INVENTORY_CATEGORIES
where
<cfloop list="#url.var#" index="i">
<cfif isNumeric(i)>
CATEGORY_ID= <cfqueryparam cfsqltype="cf_sql_integer"
value="#i#">
and
</cfif>
1=1
</cfloop>
</cfquery>
<cfelse>
<cfset LOOKUP.recordcount=0>
</cfif>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
</tr>
<cfoutput query="lookup">
<tr>
<td> </td>
<td>#row_id#</td>
</tr>
</cfoutput>
</table>
The error I am getting is:
Error Diagnostic Information
ODBC Error Code = 37000 (Syntax error or access violation)
[Microsoft][ODBC Microsoft Access Driver] Invalid use of '.',
'!', or '()'. in query expression 'CATEGORY_ID= Pa_RaM000 and 1=1
CATEGORY_ID= Pa_RaM001 and 1=1'.
The error occurred while processing an element with a general
identifier of (CFQUERY), occupying document position (2:1) to
(2:54).
Date/Time: 07/24/06 09:50:54
Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
SV1; .NET CLR 2.0.50727; .NET CLR 1.1.4322)
Remote Address: 127.0.0.1
Query String: var=2042,2045
Any ideas? Also, please keep in mind that the variables I
will send across th eurl may also have letters. For example,
var=m1001,1002,p30014. Thanks!
Similar Messages
-
Can we create range variable for Query Key Date
Hello Gurus,
Can we create a range variable for Query Key Date ? when I tried to give a range of values for Query Key Date, I am unable to find Range Values option. I found only Single Values.
so, Please let me know if we can use Range variables for Query Key Date ??
Thanks in advance,
Regards,
AarthiHi Aarthi,
This is relevant for the time dependant master data that is being pulled in thw query. Like if you are using a nav attr in the query and this nav attr is time dependant, then which record (from the char master data) is to be pulled into the report, depends upon the key date that you specify.
The default key date value is the date on which the query is executed, that is <Today>.
Hope this helps... -
CF Set form.variable for query and Next/Previous pages error
I have a CF form with a select that posts to a CF "action" page.
On the action page I: CFSET ItemNumber=#form.ItemNumber#
I CFOUTPUT the 'ItemNumber' into the CFQUERY (which is an Inner Join dependant on the '#ItemNumber#')...
All of the above works just fine and displays the database fields in color alternating rows, per the rest of the code.
Here's the problem:
I'm displaying 40 rows on a page per "Next and Previous" code. (CFPARAM name="start" default="1" and CFPARAM name="disp" default="40" along with the rest of the NextN code in the header and body). This does display 40 rows on the page and puts a link at the bottom of the page "Next 40 Rows", etc.
Note: I'm only querying the database once and using the query (query name="data") to populate the table rows And the NextN code (CFOUTPUT name="data") And (CFIF start + disp GREATER THAN data.RecordCount, etc)...
The problem happens when you click the "Next 40 Rows" link to display the 2nd page of rows. Since (I'm assuming) this NextN code is 're-reading' the same page from top to bottom, an error is thrown when the code tries to read the CFSET ItemNumber=#form.ItemNumber# at the top of the page.
With the #form.ItemNumber# on this action page Originally coming from the previous posting of the form to this action page, when the "Next 40 Rows" link is clicked and the NextN code re-reads this action page - the CFSET ItemNumber (#form.ItemNumber) is not getting populated and throws the error...
I hope I've not made this sound confusing.
I can get the NextN code to work when I'm just querying the database without "flying in" a form variable. But when I CFSET a variable (#form.ItemNumber#) that is inserted into the query, the second page of the NextN throws an error and doesn't display.
I would include the page code here but it would be fairly lengthy and, as well, the NextN code is a 'standard' CF code -- I've narrowed the problem down to the above "Element is undefined" (when the page tries to reload from the "Next 40 Rows" link) and am hoping there's a simple fix or another way to display the records in Next and Previous pages.
Thanks to anyone in advance for shedding light on this.
- eThank you for the reply, Owain.
Yes - The Next/Previous at the bottom of the page are hyperlinks.
<a href="ThisPage.cfm?start=#Evaluate("start + disp")#">
The following is at the top of the page (and is the variable from the form that I CFOUTPUT in the query):
<cfparam name="ItemNumberDropdown01" default="">
<cfset ItemNumber = #form.ItemNumberDropdown01#>
The error report showed that the "Next Page" hyperlink was reading an undefined variable... although when the "action page" first opens from the form posting to it, it populates the CFSET just fine (per the cfparam and cfset above)... As you mention, the hyperlink clearing the form scope is what causes the error in trying to display the next set of records...
The form page and the 'action page' are both secure pages with an application page setting the session, etc. Am I at risk in using an URL scope?
Where would this URL scope be put? (The href is shown above - would the URL scope go in this? - How would this be written?)
The CFPARAM and CFSET would still exist at the top of the 'action page' and still throw an error wouldn't it or would this be replaced with something else to read the form.variable for this 'first' action page to be displayed?
Thanks again for the 'education' on this...
- ed -
Variable for Query without changing Datamodel
Hello Experts,
I need in the Query a variable, which should have inpact on the processing in the user-exit. This variable should no be used directly for constraining data.
It is an Yes/No variable. And I don't have in my multicube any characteristic which have Yes/No in their domain.
In such situation I have always added to Multiprovider and Cube an new characteristic and created an variable for this characteristic.
But I don't like this solution, because this changes in the datamodel are in really not important for the datamodel. It only an work around for getting the possibility of adding a variable.
Does someone know an better idea for adding variables to query, without changing datamodel like this.
Thanks
WojciechHi Bhanu,
Not really - I don't want to change Cubes.
Thanks
Wojciech -
Hi All,
I am using time dependent master data, i want to count number of employees on particular key date for diffferent Orgunits. So i created variable in the query properties for dynamic date selection .I also have other variable - Calendar month.
If the user enters particular Calendar Day (21.03.2008), then the report should show the total number of employees for that particular day.
If the user chooses Cal Year/month then the report should show the total number of employees for that time frame (12.2007-12.2008).
When i enter Cal Year/month and execute the system not allowing to execute the report. It says Calender Day is mandatory.
How can i bypass the calenderday when i choose calyear/month.
Variable for Key date :
Char - Calender Day
Mandatory
Ready for Input
Regards
A.VasisterHi,
For this work you have to create another 2 variable.
1. Make your both user entry variables as optional.
2. Create another 2 variables processing type as user exit.
3. In the CMOD program, identify which variable contains data.
- If the user entered month, then in the user exit of Calender day's from date should be
first day of the month parameter and to date should be the last date of the month parameter.
- If the user entered date, then pass corresponding month&year value of the date to calmonth variable.
Let me know the position.
Vivek -
Hi!
How can i list every query variables created in my BI system?
I would like to see all variables created in BI querys.
Thank´s!Tables - RSZGLOBV and RSZELTTXT
Edited by: Srinivas on Jul 22, 2010 10:00 PM -
Use Yesterday as variable for Query Filter
Post Author: rrburton
CA Forum: WebIntelligence Reporting
I want to have a query filter that refers to the previous day. In regular SQL I would use something like "= trunc(sysdate)-1". I don't see any option for doing it this way in web intelligence, the closest it comes is selecting object and then assigning the Beginning of Last Week item from the System Date table. What am I missing?Post Author: rrburton
CA Forum: WebIntelligence Reporting
Nevermind - I figured it out just now. It isn't very intuitive. In the Objects and Variables dialog in the SystemDate table there are a bunch of items like 1 day, 2 days, etc. and you select one of those and then in the code it looks like:
WHERE PKG_NTD_CONV.TO_ORCL_DATE(TROUBLE_TICKET_ARCHIVE.CREATE_DATE) = ( sysdate )-1
It should say something like 1 day ago, 2 days ago, etc. -
Hai Gurus,
I have a report which gives all the requisitions with differrent status in the report based on Req. start date.
In addition to this i got a requirement in the same report where user can enter date interval..
Based on the user date interval it should populate the req's in the report only with Status ="OPEN".
My question is can we restrict this status in the Customer Exit.
If possible how can we achieve that..
Please let me know if you need any further details..
Thanks & Regards,
VJHi,
If I got you correctly, you have a report which gives PRs based on user entered Required start date. Now in the same query, you would like to put condition based on status as well.
You can achieve this in 3 ways.
1) After executing the query, you can filter the results of query by status 'Open'. This would have to be done after each time the report is executed. This approach wil not need any exits/ transport requests.
2) Create a characteristic variable on status characteristic. Make the type of this variable as 'Default/ User entry'. Select the option for 'Ready for input' and the variable should be 'Select-option'. You can give default values so that this values are populated when query is executed and pop-up comes up for user to give selection.
If you have status like 'Open', 'In progress', 'Completed', 'Terminated', then in default values section, you can give value like this
'Completed' to 'Terminated'
This would cover all the status. And if query is executed wth this value, PRs would come for all the status.
If you want the query to be executed for only 'Open' status, refresh the query, again th pop-up would come. Now, you can remove the default values and only give 'Open'. This time it would only give PRs with open status or given date range.
3) You can do 2nd step but by creating it of customer exit type. Have 'Ready for input' selected. And in customer exit, fill the variable under i_step =1 for all the statuses. therefore, when query is execute, it would come with same default values and you may change them based on your need. -
Mandatory variables for Query in APD
Hi,
I have embedded a query in APD. The query has some mandatory variables. These mandatory variables give an error in APD.
Error Message: This entry type OP_FPER(mandatory variable) requires you to enter a value
I can give a variant for the query but I want the user to enter the values for the mandatory variables in the selection screen when the APD is executed.
My question is,
1) Is it possible to have a mandatory variable in the query if it is used in APD? If so, then what should I do?Hi Anita,
no, unfortunately APD can not process a variable input screen. All variables need to be filled via query variant, hence the Analysis Process is not dynamic concerning variables.
Cheers
Thomas -
Using Text Variable for Query Description
hi all,
I am currently trying to include this text variable in the query properties of the query.
This text variable should be able to grab the 0CALMONTH as filter to be included into the query properties. but currrently cannot grab the particular information from the query properties.Hi
If I got your Question properly , You are trying to use Replacement Path Variable .. If it is so
/people/kamaljeet.kharbanda/blog/2006/12/28/bex-characteristic-variable-with-replacement-path
http://www.sd-solutions.com/documents/SDS_BW_Replacement%20Path%20Variables.html
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/009819ab-c96e-2910-bbb2-c85f7bdec04a
Hope it helps -
How do I pass value to 'getURL' url variable
Howdy,
I`m trying to launch a popup from a flash form using MX 7
The popup works fine but I cant for the life of me work out how to pass 'theid' value to the url variable for the popup window.
I think somthing like this can be done with action script and maybe a cfc but I really dont know how.
You will notice I referenced 'theid' value directly, I know this will never work but just wanted to show what i was trying to acheive. If I were using a HTML form I could use some javascrip to get the element by id and append the value to the url. Is there away to do this in action script?
<cfform format = "flash">
<cfsavecontent variable="ticketpopup">
getURL("javascript:window.open('supportdetails.cfm?id=#theid#' , 'TicketDetails', 'width=900,height=630, Scrollbars=1, resizable=0'); void(0);"); </cfsavecontent>
<cfselect name="selectbox" query="thequery" value="id" display="whatever"></select>
<cfinput type="hidden" name="theid" bind="{selectbox.selectItem.data}">
<cfinput type="button" name="mybutton" value="whatever" onClick="#ticketpopup#>
</cfform>
Any help, much appreciated :-)
ThanksI answered my own question, heres is a solution if anyone is interested..
You can add the following actionscript to the onChange attribute of the select box. Its passes the value of the selected index to the URL and opens in a new window :-)
No there is no need for a hidden field or a button either
<cfform format ="flash">
<cfselect name="name" query="thequery" value="thevalue" display="whatever">
onChange="getUrl('supportdetails.cfm?ticketnumber=' + categorysubject.dataProvider[categorysubject.selectedIndex]['data'],'_blank');
</cfselect>
</cfform> -
Passing URL Variables, Can "Or" statement applies?
in my php data, i have 2 catagorical data
cat1
cat2
most of the time, since most items have single catagory, i
can just pass 1 url variables, for ex: ?cat1=5
but on rare occasions, some of my items will have 2
attributes, making it necessary to filter not only cat1=5, but
maybe cat2=5 as well.
the way you do "and" statement is just with ampersand sign
&, but how would you do "or" statement?
(or am i totally misinterpretting the way that URL variables
work? i also thought that the filtering process might occur at the
webpage, and the & statement merely passes 2 or more variables,
while the webpage decide what to do with them. am i correct in this
statement instead?)
thanks again!
p.s. do you get anything when i declare you the official
answer? like, is there a forum level up thingy which you become
like master guru of dreamweaver helper or something...? sort of
like how they do it in yahoo answersBih Wang wrote:
> the way you do "and" statement is just with ampersand
sign &, but how would
> you do "or" statement?
You can't do an "or" statement in URL variables. The query
string (after
the question mark) is a series of name/value pairs separated
by ampersands.
> (or am i totally misinterpretting the way that URL
variables work? i also
> thought that the filtering process might occur at the
webpage, and the &
> statement merely passes 2 or more variables, while the
webpage decide what to
> do with them. am i correct in this statement instead?)
It's the script inside the web page that decides what to do
with the
variables.
> p.s. do you get anything when i declare you the official
answer? like, is
> there a forum level up thingy which you become like
master guru of dreamweaver
> helper or something...? sort of like how they do it in
yahoo answers
This forum doesn't have a points system, but we're moving to
a new forum
in a couple of weeks' time, where you can give points.
However, gaining
points won't automatically give people any titles or status.
David Powers
Adobe Community Expert, Dreamweaver
http://foundationphp.com -
Variable for Substitution for IN list
Helllo all
I have a problem... My query contains an IN list... eg.
select *
from table
where product in (1, 2, 3, 4)The problem is, I need the same query to be able to process thing based on different product lists.
eg. (1, 2, 3, 4)
or
(1, 5, 33, 87, 299)
etc.
How can I do this?
Normally you could just use a variable, but that would only work for a single value.
Is there any way to make a variable of the type of 'list' that IN uses?
Thanks!
SamI've read the above solution by Tome Kyte (great place for answers:) for doing this and was wondering if someone could give me reasons/suggestions as to
why the solution below is good or bad....
Using the example from question above.
select *
from table
where product in (1, 2, 3, 4);
We accomplish this by doing the following:
First build your list into a variable and make it a string with no quotes, even if it is a number as in this case.
You can do this with various looping methods. Also, use a separator. Here we use a tilda ~ .
So the above product list would look like the following:
Declare
v_Product_List := '~1~2~3~4~';
Begin
select *
from table
where INSTR(v_Product_List, '~'||to_char(product)||'~') > 0;
End;
I know this isn't comlete but I think you can make it work for what ever case you need.
Thanks for any feedback,
Whitney -
Dynamic list to generate url variable
Hello, I am using a dynamic list to pull product codes from a
database. I then want to pass the code into a url variable when it
goes to the results page. This is so customers can chose which code
they want to go to a detail page about. I already have the dynamic
list working, I just can not figure out how to embed the selected
code into a url variable. For example I want it to do the
following:
sitename.com/search.php <--- here is where you start and
make the selection then it brings you to:
sitename.com/details.php?code=202 <---- code202 was
selected on previous page in dynamic list.
I know how to do it by pulling results from a database and
generating links for each one, but I need to do it from a dynamic
drop down list.
Here is the coding that I was trying to use:
Thank you for your assistance.Sorry, dumb error on my part. Used method=post rather then
get. -
Extract the "bind" variables for a given query running in 10g.
how can we extract the "bind" variables for a given query running in 10g? The performance of a query may vary based on the parameters supplied to it. For example, a query like the following
SELECT * FROM CUSTOMER_ORDERS WHERE CUSTOMER = :CUST_ID
.might run differently when the :CUST_ID is "123" who may have very few orders versus "456" who may have tens of thousands of orders.
So, if we see a spike in the system due to a query, we need visibility into what the exact query syntax and values are for any database session. We're aware of an Oracle view called V$SQL_BIND_CAPTURE, but what we're finding with this view is that it's only a snapshot of variables that are refreshed on an interval. That view does not give us a live view into what values are being used in the various sessions in realtime.
If someone ould provide us with some SQL (or other means) to do get a realtime view into the SQL and variables currently running in the database, it would be greatly appreciated.In addition to what's been said in the other thread, you could add a layer of logging either in the database or out.
v$sql_bind_capture and the associated ash view dba_hist_sqlbind contain sample data.
You could up the sample rate but it's not advisable - it's still just a sample.
If you're on 11g, this is where adaptive cursor sharing might help.
Not help in finding the values of your binds, but help in using different plans where there is such a skew for different bind values and the plan is perhaps wrong for customer 456.
The problem when you're got such a skew and you're using bind variables is that the two don't really go together.
When the query is next parsed and you've got bind variable peeking enabled, you might get the 123 plan is that is the bind value at parse time and then run into problems for 456 or even vice versa.
See http://jonathanlewis.wordpress.com/2009/05/06/philosophy-1/ for a discussion on binds and histograms which reflects the reasons for using either.
Maybe you are looking for
-
Temporary solution to play flv files on nokia n8 h...
Solution for playing flv video files from nokia N8 Following are the steps 1) Open the file 2) Quickly tap the screen, and move the volume key up and down 3) again tap the screen and that's all, now enjoy the video as you did prior to belle . note: t
-
Hello Question got new I pads for xmas, down load music, some movies, but on the rental side have some thier, some are active and other in clouds would very much to finish this down load thank you
-
How to delete Guest User Account
I just got my Mac book Pro and I'm new to Mac. I created a Guest User Account and now I want to delete it. But the - (minus) option is grey out. How can I delete the Guest User Account? I have two accounts listed right now. The Admin and the Guest Ac
-
I'm trying to solidify my workflow, and I was hoping you FCP wizards could clarify something for me. When it comes to exporting finished video from FCP to create DVD's in DVD Studio Pro, I have seen several arguments over what is the best way. I'm su
-
Setting Node Attributes for a non singleton node
HI, I want to know what is the correct way to set attributes for a non singleton node dynamically. I have node A which contains the non singleton node B. At runtime I want to change the attributes of node B dynamically. What is the correct way for th