Querying value from a range of two values

I have patched together a shopping cart, operating on CF8,  and am now trying to add shipping.  The client wants the shipping charges based on the cost of item, ie:
0-$499 is $20
$500 – $999 is $25.00
$999 – up $45
I built an access table (simplified) with the following rows
Price_min, Price_max,ship_cost
The idea is to query the subtotal from the price_min and Price_max to determine the shipping cost:
<cfquery name="getInfo" datasource="#application.databasePRD#">
select ship_cost, price_min,price_max
from shipping
where price_min >= #form.subtotal# and price_max <= #form.subtotal#>
</cfquery>
</cfif>
<cfoutput query="getInfo">
#ship_cost#
</cfoutput>
Alas, I get the following error:
Syntax error (missing operator) in query expression ‘price_min  >= 29 and  price_max <= 29'.
What am I doing wrong?

Rickaclark54,
I expected your query to work. However, from your explanation, I expected the operators to be the other way round! That is, this query:
<cfquery name="getInfo" datasource="#application.databasePRD#">
select ship_cost, price_min, price_max
from shipping
where shipping.price_min <= #form.subtotal#
and    shipping.price_max >= #form.subtotal#
</cfquery>
If you continue to have problems, then verify that the database columns ship_cost, price_min and price_max have numeric datatypes. In any case, an even better query statement is:
<cfquery name="getInfo" datasource="#application.databasePRD#">
select ship_cost, price_min, price_max
from shipping
where shipping.price_min <= <cfqueryparam cfsqltype="cf_sql_numeric" value="#form.subtotal#">
and    shipping.price_max >= <cfqueryparam cfsqltype="cf_sql_numeric" value="#form.subtotal#">
</cfquery>

Similar Messages

  • Problem in query jump from one sender and two receivers

    Hello all,
    My requirement is to jump from one query to another two queries. The sender comes from infoCube A and receivers comes from ODS B and ODS C (ODS C is a copy of ODS B). The problem is that when I execute the first jump a pop up appears with a selection date. This issue does not happen when I execute the second jump (and the selection date is needed). Target queries are identical, and I don´t know what is happening.
    Any ideas?
    Thanks in advance.
    Carmen

    Hi Carmen,
    I think you have used the same variable for the day selection for the query on ODS C and ODS B. Hence when you fill it for the first time it does not ask you at the second instance.
    Regards.

  • How to get the query values from the url in a servlet and pass them to jsp

    ok..this is the situation...
    all applications are routed through a login page...
    so if we have a url like www.abc.com/appA/login?param1=A&param2=B , the query string must be passed onto a servlet(which is invoked before the login page is displayed)..the servlet must process the query string and then should pass all those values(as hidden values) to the login jsp..then user enters username and pswd, then there should be another servlet which takes all the hidden values of jsp and also username and pswd, authenticates the user and sends the control back to that particular application along with the hidden values...
    so i need help on how to parse the query string from the original url in the servlet, pass it out to jsp, and then pass it back to the servlet and back to the original application...damnn...any help would be greatly appreciated...thanks

    ok..this is the situation...Sounds like you have a bad design on your hands.
    You're going to send passwords in a GET request as clear text? Nice security there.
    Why not start with basic security and work your way up?
    %

  • Date Deviates from permissible range [Purchase Order - Value Date]

    hello all,
    i want to add a Purchase Order (Services) Posting date 05/07/2008 and Delivery Date is 09/30/2008, it prompts me the Error "Date Deviates from permissible range [Purchase Order - Value Date]", now this is my question.
    what is the date range for PO posting date and delivery date that the system will allow(date difference)? can i set this one?
    Note: we need to make an advance PO for this since our BP required this time period for them to accomplished.
    Please help.
    Thanks.
    FIDEL

    FIDEL,
    All documents have 3 dates DocDate, DocDueDate, TaxDate.  The date ranges for these dates are taken from the Active Posting period definition.
    Open Administration  > System Initialization  > General Settings > Posting Periods
    Click on the Yellow link arrow next to the current posting period and check the Due Date From and To Range and expand the To date to cover 09/30/2008
    Posting Date From
    Due Date From
    Document Date From
    Suda

  • Numeric value deviates from legal range

    Dear Experts,
    I am facing this error(Numeric value deviates from legal range (ODBC -1015)  [131-183]) while copying P.O. to GRPO.
    Plz help on this.
    Any suggestion will be highly appreciated.
    Regards,
    Ravi

    Hi,
    Please check SAP note:
    902123
    - Maximum Number in Numeric UDF
    Thanks & Regards,
    Nagarajan

  • Programatically Querying Values from Garbage Collector Manager MBean

    Querying attribute values from some MBean are very easy such as : Available
    Object mbeanObjectName = new ObjectName("java.lang:type=OperatingSystem");
    Object attribute = _mbsc.getAttribute(mbeanObjectName, "AvailableProcessors");My question is... Is there an easy way to query values such as
    LastGcInfo in java.lang:type=GarbageCollector,name=MarkSweepCompact
    Inside this attribute, the value for memoryUsageAfterGc is a type of Map (TablularData). The tablular data contains a key and value pair. I am after Perm Gen. The value is a CompositeData type.
    After drilling all the way in, I arive at the value I am after "used".
    Is there an easy way to query this value directly? Maybe through getAttribute?
    Or, is the only way to write a lot of code and iterating through the maps and composite data?

    By far the easiest way of dealing with MXBeans programmatically is through MXBean proxies. You can do this:
    import com.sun.management.GarbageCollectorMXBean;
    import com.sun.management.GcInfo;
    ...other imports from java.*...
    GarbageCollectorMXBean gcm =
         ManagementFactory.newPlatformMXBeanProxy(
            _mbsc, "java.lang:type=GarbageCollector,name=MarkSweepCompact",
            GarbageCollectorMXBean.class);
    GcInfo gci = gcm.getLastGcInfo();
    Map<String, MemoryUsage> map = gci.getMemoryUsageAfterGc();
    MemoryUsage mu = map.get("PS Perm Gen");
    long used = mu.getUsed();It's still a fair amount of code, but you don't need to iterate over anything or look at CompositeData ever.
    The com.sun.management interfaces used here are documented at http://java.sun.com/javase/6/docs/jre/api/management/extension/overview-summary.html
    Regards,
    �amonn McManus -- JMX Spec Lead -- http://weblogs.java.net/blog/emcmanus

  • How to set Query value in WAD w. parameters

    Hi
    Is it possible to set the queryname in the dataprovider using javascript.
    My scenario is that I want to fetch the queryname from the URL with the following javascript
    I have the script:
    function GetPara( name )
         name = name.replace(/[\[]/,"
    \[").replace(/[\]]/,"
         var regexS = "[
    ?&]"name"=([^&#]*)"; 
         var regex = new RegExp( regexS ); 
         var results = regex.exec( window.location.href ); 
         if( results == null )   
              return ""; 
         else   
              return results[1];
    And then I want to implement something like the following in the template
    //First dataprovider (TAB_A_DP) initialization
    <bi:QUERY_VIEW_DATA_PROVIDER name="TAB_A_DP" >
                    <bi:INITIAL_STATE type="CHOICE" value="QUERY" >
                        <bi:QUERY value="SCRIPT_FUNCTION">
                               <bi:SCRIPT_FUNCTION value="GetPara('TAB1')" />
                        </bi:QUERY>
                    </bi:INITIAL_STATE>
                </bi:QUERY_VIEW_DATA_PROVIDER>
    //SEcond dataprovider (TAB_B_DP) initialization
    <bi:QUERY_VIEW_DATA_PROVIDER name="TAB_B_DP" >
                    <bi:INITIAL_STATE type="CHOICE" value="QUERY" >
                        <bi:QUERY value="SCRIPT_FUNCTION">
                               <bi:SCRIPT_FUNCTION value="GetPara('TAB2')" />
                        </bi:QUERY>
                    </bi:INITIAL_STATE>
                </bi:QUERY_VIEW_DATA_PROVIDER>

    Hi Leo
    Sorry I haven't explained my goal very well.
    I want to create a dynamic webtemplate w. two tabs. One tab showing data from one dataprovider and the other tab showing data from another dataprovider.
    My problem is that it's easy enough to set the dataprovider to a specific query but as I have several reports which should use this template then instead of coping the template and change the query name I want a generic way to set the queryname  (e.g. in the url) so I only have one template and not a template per report pair.
    In short I want to set the Initial State dynamic.
                                <bi:QUERY_VIEW_DATA_PROVIDER name="TAB_A_DP" >
                                    <bi:INITIAL_STATE type="CHOICE" value="QUERY" >
                                        <bi:QUERY value="dynamic" text="dynamic" />
                                    </bi:INITIAL_STATE>
                                </bi:QUERY_VIEW_DATA_PROVIDER>
    When I only have one dp I can leave it empty and set the query by typing ?query=<queryname> but what if I have several dataproviders with different queries?
    /John
    Edited by: John Dolph on Aug 26, 2009 3:22 PM

  • How to use FMS on OPCH field to query value on a field in PHC1 form?

    Hi All,
    I have a problem. I created a user defined field in the AP Invoice form (parent form-OPCH). Now I would like to use the formatted search to add a query to that field that will select a value from another field also on the same form but at the row level (child form-PCH1). It seems that this is not possible. Any suggestions?
    A general question for this: is their any way that I could use the formatted search to query value on an opening form that is inactive?
    Thanks
    Duc

    Hi Sampath Kumar devunuri,
    Thanks for your reply. It does not work. I have tried to searched through the forum about this topic and it seems that FMS will not work at row level. Not sure if there is any solution to overcome this.
    My query is for example: I want my UDF on OPCH form to capture the description of the first row in PCH1:
    Select $[$39.1.1]
    If I assign it to a UDF at row level it works perfectly.
    If I assign it to the Remark field on OPCH it still works.
    But if I assign it to a UDF at title level it does not (this is what I need)
    This may be because at title level the form name is OPCH which is different with the form name at row level: PCH1
    I cannot think if there is any way that I could set focus on PCH1 to get the value.
    Duc

  • Query Values are not updated.

    Hello All,
    While refreshing the query on the cube 0IC_C03, i am not getting the correct values in the query,  Cube 0IC_C03 values and query values are differ.
    when i Tested inthe RSRV test it shows
    "<b>Dimension key 398 missing in dimension table /BI0/D0IC_C03P</b> "
    if any one knows plz guide me.
    Regards
    Chintaps

    Hello,
    I did not find DIM ID in DImension table. and
    when i checked Masterdata consistency check at RSRV level it gives-
    There is a inconsisitency in masterdata for 0MATERIAL.
    Characters not allowed characteristic values(characteristic 0MATERIAL)
    Value in SID table 000001000001/ correct value 000000000001000001/ SID in SID table 41037
    Value in SID table 000001000002/ correct value 000000000001000002/ SID in SID table 41038
    Value in SID table 000001000003/ correct value 000000000001000003/ SID in SID table 41039
    Value in SID table 000001000004/ correct value 000000000001000004/ SID in SID table 41040
    Value in SID table 000001000005/ correct value 000000000001000005/ SID in SID table 41041
    Value in SID table 000001000006/ correct value 000000000001000006/ SID in SID table 41042
    Value in SID table 000001000007/ correct value 000000000001000007/ SID in SID table 41043
    Value in SID table 000001000008/ correct value 000000000001000008/ SID in SID table 41044
    Value in SID table 000001000009/ correct value 000000000001000009/ SID in SID table 41045
    Value in SID table 000001000010/ correct value 000000000001000010/ SID in SID table 41046
    and i checked the program RSDMD_CHECKPRG_ALL for the 0MATERIAL
    Characteristic 0MATERIAL: 288 values from table /BI0/TMATERIAL do not exist in table /BI0/SMATERIAL.
    and  gives me a message Some versions are incorrect.     
    if anyone have an idea , please suggest me.
    Regards
    Chintaps

  • Query values in a form

    I'm trying to use a form to display query values and then pass a value to another page for processing. Here's part of my code
    <%
    rs = statement.executeQuery("SELECT * FROM users WHERE start_date > '7/1/2001');
    %>
    <table>
    <form name = "form1" action = "xyz.jsp" method = "get">
    <% while(rs.next()) %>
    <tr>
    <td><%out.println(rs.getString("user_id);%></td>
    <td><%out.println(rs.getString("user_name);%></td>
    <td><input type ="hidden",
    name="user"
    value="<%out.println(rs.getString("user_name));%>">
    <input type="Submit" value = "Do it">
    </td></tr></form></table>
    In the form that I'm calling I have this code to receive the value:
    String user_in = requet.getParameter("user");
    The problem that I'm having is if the query returns 10 records and the user_id are numbers 1- 10. When I select the second user_id (user_id = 2) to submit, it is always passing the value of the first record (ie user_id = 1). How can I code this to make it pass the correct value?

    How are you selecting second user ? I dont see anything relates to that in your code.
    I dont under stand problem completely but when you create hidden fields in a loop with same name it create create duplicate hidden fields with same name and different values
    replace hidden field code with this
    <%int i =1; %>
    <input type ="hidden",
    name="user"+'<%=i%>'
    value="<%out.println(rs.getString("user_name));%>">
    <%i=i++;%>

  • Get Query value Technical Name

    Hi,
    I have ZANALYSIS template and different queries use this template, I have to show a link to download a document. The document will be stored as Query Techincal Name.DOC.
    So i need to get QUERY techincal name in runtime to build path, how can i get the query techincal name....using javascript.
    <object>
    <param name="OWNER" value="SAP_BW"/>
    <param name="CMD" value="GET_ITEM"/>
    <param name="NAME" value="THIS VALUE WILL BE FROM Bex iview"/>
    function buildUrl(){
    var url = "http:testbox:50000/irj/km......"document.getElementById("QUERY").innerHTML".DOC";
    alert(val);
    basically my document path is .."http:testbox:50000/irj/km......"<QUERY TECHNICAL NAME>".DOC"
    Iam not gettng the QUERY techincal name..can anyone please help to solve this issue...
    iam using NW04's...
    Thanks,
    Damodhar.

    Hi,
    I have to get the query value using java script.....
                <bi:QUERY_VIEW_DATA_PROVIDER name="DP_1" >
                    <bi:INITIAL_STATE type="CHOICE" value="QUERY" >
                        <bi:QUERY value="<b> i need to get this value using java script</b>" />
                    </bi:INITIAL_STATE>
                </bi:QUERY_VIEW_DATA_PROVIDER>
    any suggestions ..please..
    Thanks,
    Damodhar.

  • DRG-11112: length of CLOB query value exceeds maximum of 64000

    Is there a CLOB length limitation when running an Oracle Text search? (v 11.1.0.7) I have checked the Reference Guide and Application Developer's Guide.
    --create table
    create table nk_1929(id number, vc_a clob);
    --insert dummy data
    declare
    vc_clob clob;
    begin
    vc_clob := lpad(to_clob('a'), 222920, 'a');
    insert into nk_1929 values(1, vc_clob);
    end;
    --create index
    create index nk_1929_ndx on nk_1929(vc_a)
    indextype is ctxsys.context parameters('
    datastore ctxsys.default_datastore
    stoplist ctxsys.empty_stoplist');
    --run query with a search string longer than 64000
    declare
    str1 clob;
    query_term clob;
    begin
    select vc_a into query_term from nk_1929 where id = 1;
    str1 := 'select id from nk_1929 where contains(vc_a, :1) > 0';
    execute immediate str1 using query_term;
    end;
    ORA-29902: error in executing ODCIIndexStart() routine
    ORA-20000: Oracle Text error:
    DRG-11112: length of CLOB Query Value exceeds maximum of 64000
    Please let me know if I am missing something here?

    Same 64000 CLOB query value limitation is also generated with a simple select:
    --run query with a search string longer than 64000
    declare
    vn_id number;
    query_term clob;
    begin
    select vc_a into query_term from nk_1929 where id = 1;
    select max(id) into vn_id from nk_1929 where contains(vc_a, query_term) > 0;
    end;
    ORA-29902: error in executing ODCIIndexStart() routine
    ORA-20000: Oracle Text error:
    DRG-11112: length of CLOB Query Value exceeds maximum of 64000

  • Tkprof High query value

    Hi friend;
    I have one tkrpof and end of the file the query value is too high like 43830952, what doest it mean? How i can solve this problem

    Yes you can :) You need to use \ tags.
    \Your text here\yieldsYour text hereThe query column reflects the number of logical I/Os performed. So it looks like you performed 43,830,952 logical I/Os in roughly 33 minutes. What I would do personally is if you are having performance problems try and identify the query or queries in the TKPROF report that are performing the most I/O or have the highest elapsed time.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Primary Key Violation at the time of Moving from primary range to secondary range.

    Hi Experts,
    I've observed a strange issue in our environment.
    we are using sql server 2008 R2 with SP2.
    whenever a table is moving from primary range to secondary range on it's identity values, application is getting crashed with the message as below. 
    Violation of PRIMARY KEY constraint 'PK6'. Cannot insert duplicate key in object 'dbo.TD_TRANN'. The duplicate key value is (17868679).
    The statement has been terminated.
    OR
    Violation of UNIQUE KEY constraint 'IX_TDS_COST'. Cannot insert duplicate key in object 'dbo.TDS_COST'. The duplicate key value is (17, 19431201).
    identity ranges were auto managed by replication. agents are running continuous.
    please suggest.
    Cheers, Vinod Mallolu

    Well this is pretty simple, so there are two type of subscriptions (Server and client) in merge replication. So while adding article you provide following parameters:
    @pub_identity_range
    @identity_range
    You can check the details of above parameters on following article:http://msdn.microsoft.com/en-us/library/ms174329.aspx
    Snippet
     @pub_identity_range= ]
    pub_identity_range              
    Controls the identity range size allocated to a Subscriber with a server subscription when automatic identity range management is used. This identity range is reserved for a republishing Subscriber to allocate to its own Subscribers.
    pub_identity_range is bigint, with a default of NULL. You must specify this parameter if
    identityrangemanagementoption is auto or if
    auto_identity_range is true.
    [ @identity_range= ]
    identity_range              
    Controls the identity range size allocated both to the Publisher and to the Subscriber when automatic identity range management is used.
    identity_range is bigint, with a default of NULL. You must specify this parameter if
    identityrangemanagementoption is auto or if
    auto_identity_range is true.
    So for example you are adding "Server" type subscription then we consider @pub_identity_range value while assigning the range to that sub. If it is "Client" type subscription in that case we consider @identity_range value.
    You could run following query to check the range assigned to each publisher and subscriber:
    SELECT B.SUBSCRIBER_SERVER,B.DB_NAME,A.* FROM MSMERGE_IDENTITY_RANGE A,SYSMERGESUBSCRIPTIONS B
    WHERE A.SUBID=B.SUBID
    This should answer your other question as well.
    Vikas Rana | Please mark solved if I've answered your question, vote for it as helpful to help other user's find a solution quicker -------------------------------------------------------------------------------- This posting is provided "AS IS"
    with no warranties, and confers no rights. ------------------------------------------------

  • Use evdre to query data from a SQL View

    Hi all
    I believe that it is possible to use evdre to query data from a SQL View. If this is possible then how does one go about setting it up in the evdre options (assuming that the view has already been created)?
    Regards,
    Byron

    Byron,  perhaps this is no longer supported, it might be worth opening up a case at service.sap.com on this.  However, I did find the following on Page 11 of the "Usages and Considerations of EVDRE" pdf file.  This doc is imbedded in the helpfile for BPC 7 SP5 (which was released in August of 2009, well after note 1315011 was last updated.
    It looks like you are limited to one custom view per application, since you have to name the view in a parameter at the APPLICATION level.  Go into BPC Administration, login to the application related to the custom view, choose "Set Application Parameters" and enter the name of the view to the Application Parameter called "EVDRE_QUERYVIEWNAME"  If it is not listed, go ahead and create it at the bottom of the Application parameter screen.
    Also:  I interpreted the following info from Page 10 of the same doc:
    In your EVDRE, set the following options:
    QueryEngine: MANUAL
    QueryType:  enter either NEXJ  OR TUPLE  see below:
    NEXJ  - Use two-dimensional queries using the nonemptycrossjoin function
    TUPLE  - Use two-dimensional queries using tuples"
    And I'm assuming you'd enter a Y for the following two parameters:
    QueryViewName
    "..to enforce the query engine to use a used-defined SQL view of the fact tables, when trying to read the values using SQL queries. This option is typically used in conjunction with the SQLOnly option (see below). "
    Option SQLOnly
    "..to enforce the query engine to only execute SQL queries, when reading data. This can be achieved using this option."

Maybe you are looking for

  • Unicode error in program

    I am getting the following error when I do a syntax check when using a PNP logical database with unicode checkbox checked in attributes.  Can someone give me a solution to avoid that.   Thanks in advance In unicode programs the - cannot appear in nam

  • Blackberry Desktop Software - Request Option to Disable Software from Loading During Start-Up

    After Blackberry Desktop Software automatic updates. Software become part of Start-Up option or menu. I do not want Blackberry Desktop Software to automatically load during Start-Up. The Desktop Software does not have a user friendly option to disabl

  • How to hide column link URL on status bar?

    Apex 4.1 I have IR wit one column link target to URL, and it uses javascript:my_function(#COLUMN_VALUE#)as URL, that is, calls some function and passes the value of that column to the function; everything works fine; but when I place a cursor over th

  • Title in Brower Window

    Hi - I use Captivate 4. Title of course in browser window is incorrect when project is preview or published.  I have checked preferences, properties, publish settings, etc.  All titles are correct.  On this forum I found info about changing this in e

  • Used rank mirror script but everyone "connection time-out

    What is going on? I can ping google no problem, but like the subject says everything says "connection time-out" when I try to pacman -Syy or when I try to pacstrap /mnt base base-devel So what is going on?