First Mathematical Function

I'm stumped. I am filtering a query and I need to be able to
use a First function in ColdFusion, like in Access.
This is what my query is in Access:
SELECT First(query2.Latitude) AS Latitude,
First(query2.Longitude) AS Longitude
FROM query2
This is what I need my query to be in ColdFusion:
<cfquery name="getAVG" dbtype="query">
SELECT min(passedzip.Latitude) AS latitude,
MIN(passedzip.Longitude) AS longitude
FROM passedzip
</cfquery>
Of course, ColdFusion doesn't support the First function and
it's really screwing me up. Min doesn't work - I need First.
Does anybody out there have a clue as to how to work around
this? I am using a query of queries in my site to get the results I
need.
Thank you!

How about just using #QueryName.ColumnName# outside of a
<cfoutput
query=""> or <cfloop query=""> loop. It will always
return the first
row in your query.
Or more properly... #queryName.ColumnName[1]# which is what
the above is
a short cut to though this allows one to get the second row
if they
desire, ex. #queryName.ColumnName[2]#. And of course if you
replace the
integer in the row designation with a variable containing an
integer,
then all kinds of fun things can be done.

Similar Messages

  • What is the mathematical function associated to linear, map ranges, polynomial, table scale?

    What is the mathematical function associated to linear, map ranges, polynomial, table scale? I'd like to use the scale of daqmx for use with other types of data.

    yes, refer to the help, but only found information on the first option "linear". what I intend to is to be able to climb a number, using one of the existing scales, but don't be that mathematical function is necessary to use.

  • How to use mathematical functions in XSL mapping

    Hi,
    I am using Jdeveloper 10.1.3.3. I need to insert mathematical functions like "multiply,divide,power" etc in my mapping. But in the XSL i am getting all string functions and very few math functions for number.
    I am newbie in Jdev. Please if anyone can share how this can be done.
    Thanks

    Hi,
    The RfcAdapter trys to find a Sender Agreement for this RFC call but the lookup failes. The values used for this lookup are:
    Sender Party/Sender Service: The values from Party and Service belonging to the sender channel.
    Sender Interface: The name of the RFC function module.
    Sender Namespace: The fix RFC namespace urn:sap-com:document:sap:rfc:functions
    Receiver Party/Receiver Service: These fields are empty. This will match the wildcard
    Regards,
    Suryanarayana

  • How do mathematical functions in a table invoked in jsf page

    hi i need detail about how can i do mathematical functions for data in table in jsf page using adf bc. for example in my table(sales) i give product id,name,unit price, quantity then i want to calculate product of quantity and unit price in a table automatically and store in total amount column

    Hi,
    John suggestion would work. Another option is to define it in EL using #{row.quantity * row.unitPrice} as the outputText value. Then add a numberConverter to the outputText using type="currency". The best option, imho, is to define the totalAmount attribute on the VO and implement the product there. However, keep the converter on the inputText and don't use the display hints on the VO.
    Regards,
    ~ Simon

  • First call function problem

    hello there,
    i am using labview's first call function inside a for loop, inside a sequence structure. inside the for loop the function works fine activating a true/false structure, however, when i attempt to do the same thing outside the for loop i get a broken arrow. It says that the the tunnel of the case structure, to which i have wired the first call function, is missing an assignment to it. Cant understand why it is fine in one part and not in the other. Perhaps somebody has encountered this before? I have atttached the relevant code
    Thank you
    Dave
    Attachments:
    forum.vi ‏467 KB

    Stranger, I think if you will look closely at the case statement you will see that you have inadvertently added an output tunnel. Either delete the case and redo it or just click on the input tunnel and move it down enough to see and delete the unwired output tunnel.
    goldie

  • Create a mathematical function out of samples

    hello
    I'd like to know how can i create a mathematical function out of
    samples of a signal (sine wave for example ) .
    the samples (around 1000 samples) are known( taken from a text file),
    and also the time between every sample is known.
    thanks a lot
    Elad

    What you are probably looking for is fitting experimental data to a model function.
    LabVIEW has many fitting algorithms built-in and it depends on the desired function to decide what is best. You can fit to a line, polynomial, or exponential, etc., or you can use levenberg-marquardt for more complex models.
    If you want to fit to a single sine function, you could use "Extract single tone".
    Tell us a little more about your data.
    LabVIEW Champion . Do more with less code and in less time .

  • Programming mathematical function spaces in f#.....

    This is a very general question in order to perhaps get some redirection to the appropriate resources....II am interested in the idea of representing mathematical function spaces using f# to program the function relationships..... The idea s that in math...
    Function spaces use function instead of vectors in vector spaces... I would like to get an idea of how to implement function spaces in f#.....?????????.......
    Thank you........

    g2d.draw(polygon)

  • Mathematical functions - Frac, trunc, ceil

    Hi,
    I'm trying to use Mathematical functions like ceil, trunc... in a class method
    but they don't work.
    How can I solve the problem?
    data: appo_dec type p decimals 2,
            wa_val  type p decimals 2 value '1.75'.
    appo_dec = FRAC( wa_val ).
    The variable appo_dec always is zero.
    This code work in a report but not work in a class method.

    Well, so your variable probably becomes empty somewhere before calling FRAC...
    I gave it a try, got no issue at all...
    *       CLASS lcl_test DEFINITION
    CLASS lcl_test DEFINITION.
       PUBLIC SECTION.
         CLASS-METHODS: _frac.
    ENDCLASS.                    "lcl_test DEFINITION
    *       CLASS lcl_test IMPLEMENTATION
    CLASS lcl_test IMPLEMENTATION.
       METHOD _frac.
         DATA: l_dec TYPE p DECIMALS 2,
               l_val TYPE p DECIMALS 2 VALUE '1.75'.
         l_dec = FRAC( l_val ).
         WRITE: l_dec.
       ENDMETHOD.                    "_frac
    ENDCLASS.                    "lcl_test IMPLEMENTATION
    START-OF-SELECTION.
       lcl_test=>_frac( ).
    Kr,
    Manu.

  • How to use the first row function value for the rest of records

    Hi all,
    I am having a select statement like this. We are calling function enabled for each row. So it is taking
    time. As per our bussiness logic, we can use what the function 'enabled' will give for the first row to
    other rows also. so that we can avoid calling the function 'enabled' next row onwars.
    Before
    SELECT
    decode(enabled(col1, col2, col3),'TRUE','xxx', col4),
    decode(enabled(col1, col2, col3),'TRUE','xxx', col5),
    decode(enabled(col1, col2, col3),'TRUE','xxx', col6),
    decode(enabled(col1, col2, col3),'TRUE','xxx', col7),
    decode(enabled(col1, col2, col3),'TRUE','xxx', col8),
    from
    table1 t1, table2 t2 where t1.col1 = t2.col1
    After
    SELECT
    decode(enabled(col1, col2, col3),'TRUE','xxx', col4),
    decode('true/false','TRUE','xxx', col5), --Here 'true/false' is the first row value after calling the function 'enabled'
    decode('true/false','TRUE','xxx', col6),
    decode('true/false','TRUE','xxx', col7),
    decode('true/false','TRUE','xxx', col8),
    from
    table1 t1, table2 t2 where t1.col1 = t2.col1
    Any thoughts on this, how to implement this logic
    Thanks,
    Pal

    It's not clear where col1, col2, col3... etc. come from, so I've assumed they're in table1.
    with table1_X as (select enabled(col1, col2, col3) as enbl
                            ,col1, col2, col3, col4, col5, col6, col7, col8
                      from   table1)
    SELECT decode(t1.enbl,'TRUE','xxx', col4)
          ,decode(t1.enbl,'TRUE','xxx', col5)
          ,decode(t1.enbl,'TRUE','xxx', col6),
          ,decode(t1.enbl,'TRUE','xxx', col7),
          ,decode(t1.enbl,'TRUE','xxx', col8),
    from   table1_x t1 join table2 t2 on (t1.col1 = t2.col1)p.s. you'd be better leaving out the enabled function altogether and incorporating the logic of the function directly in the SQL, and then you would be avoiding any context switching which will clearly impact performance on any large amount of data.
    Edited by: BluShadow on 14-May-2013 08:26

  • Performance: Mathematical functions

    I'm a recent convert to Oracle and need some advice.
    Scenario:
    1. Our client has a web application written in Java that queries an Oracle database to extract a list of stores based on their location.
    2. The client approached us to rewrite the application in .Net, but the database remains Oracle10g
    3. In the existing Java application there were no stored procedures used so we created much of the logic, that used to be in Java, in stored procedures.
    Problem:
    When extracting a list of stores, 5 at the most, the performance is considerably slower than their existing application. One of the points mentioned is that Oracle isn't the best place to put code that relies on mathematical equations.
    Finer detail:
    Each store record in the database has a latitude and longitude value. The user searches by postal code and the application has to return the X closest stores to them.
    We have a function which accepts the lat and long values and calculates a distance based on math equations including the use of Sin, Atan, etc.
    So in the select query we would have something to the effect of:
    SELECT storeName, round(CalcDistance(parms),13) AS Distance FROM Stores WHERE .... ORDER BY Distance
    Should this kind of code be done rather in the business logic layer or are we missing something about Oracle?
    Regards,
    J.Hov

    user11303583 wrote:
    One of the points mentioned is that Oracle isn't the best place to put code that relies on mathematical equations. As a general statement that is completely false.
    Finer detail:
    Each store record in the database has a latitude and longitude value. The user searches by postal code and the application has to return the X closest stores to them.
    We have a function which accepts the lat and long values and calculates a distance based on math equations including the use of Sin, Atan, etc.
    So in the select query we would have something to the effect of:
    SELECT storeName, round(CalcDistance(parms),13) AS Distance FROM Stores WHERE .... ORDER BY DistanceOk, the problem you are experiencing is generally referred to as context switching. This happens when you call a PL/SQL function from within SQL and you're doing it many times e.g. a function call for each row. This is because for each row the function is called and the value is passed back, causing oracle to have to switch between the SQL 'engine' and the PL/SQL 'engine', passing all relevant information in the process.
    Likewise you can get a performance problem if you call SQL lots of times from within PL/SQL (rather than using single SQL's effecting many rows).. e.g.
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    v_sysdate DATE;
      3  begin
      4    v_sysdate := SYSDATE;
      5    INSERT INTO mytable SELECT rownum FROM DUAL CONNECT BY ROWNUM <= 1000000;
      6    DBMS_OUTPUT.PUT_LINE('Single Transaction: Time Taken: '||ROUND(((SYSDATE-v_sysdate)*(24*60*60)),0));
      7    EXECUTE IMMEDIATE 'TRUNCATE TABLE mytable';
      8    v_sysdate := SYSDATE;
      9    FOR i IN 1..1000000
    10    LOOP
    11      INSERT INTO mytable (x) VALUES (i);
    12    END LOOP;
    13    DBMS_OUTPUT.PUT_LINE('Multi Transaction: Time Taken: '||ROUND(((SYSDATE-v_sysdate)*(24*60*60)),0));
    14    EXECUTE IMMEDIATE 'TRUNCATE TABLE mytable';
    15* end;
    SQL> /
    Single Transaction: Time Taken: 1
    Multi Transaction: Time Taken: 37
    PL/SQL procedure successfully completed.
    SQL>As you can see the performance difference can be quite a good factor higher if there's a lot of context switching.
    The way to solve this is to either write your SQL statement within PL/SQL so that it processes many rows in one go, or for your particular issue, re-write your SQL statement to do the calculation as part of the SQL rather than calling user defined PL/SQL functions. You may find using Oracle's built in spatial packages useful as these are already compiled as low-level code and optimised for performance, but you may find, if the calculations can be done within the SQL itself it will be the quickest.

  • Mathematical Functions in Pages

    Hey Ya'll
    Just started a degree course in Civil Engineering. My whole school is working in Word ~ God can you believe it...!! Anyhow, just trying to work through pages to see if it will be compatible ( and in most cases it is as I can save all docs in Word). But what about complex mathematical equations & functions. In WORD you can create the most outrageous functions and equations but in pages you can only add, subtract and the other easy stuff. Is there a program out there that will allow me to keep working in pages but use the complex stuff as well or should I just throw in the towel and buy Office??
    Thanks in advance.
    RutterNFA

    The result is awful !
    But, if I understood well the OP's question, it was not about a formula editor but about the ability to create complex formulas in table's cells.
    But what about complex mathematical equations & functions. In WORD you can create the most outrageous functions and equations but in pages you can only _add, subtract and the other easy stuff_ .
    But maybe I am wrong.
    About Equations editor, look at:
    http://www.uoregon.edu/~noeckel/Keynote.html
    http://evolve.lse.ac.uk/software/EquationEditor/
    http://www.mathmagic.com/download/
    and even at the Equation editor embedded in openOffice.
    Yvan KOENIG (from FRANCE lundi 13 octobre 2008 14:00:57)

  • Add a mathematical function in Query Designer ?

    Hi,
    Do you know if it is possible to add a function in the Query Designer on formula screen ? If yes ... how ?
    Thanks a lot,
    CG.

    You can use the CEIL and FLOOR Functions for this
    Suppose you have a Key Figure K.F . hide this key figure and create a new formula Key Figure and create a formula as shown below.
    ( FRAC ( 'K.F' ) >= 0.5 ) * CEIL ( 'K.F' ) + ( FRAC ( 'K.F' ) < 0.5 ) * FLOOR ('K.F' )
    CEIL, FLOOR and FRAC will be available under Mathematical Functions

  • Oracle mathematical functions

    Hey guys,
    Not sure if this falls under the PL/SQL category or not, but in regards to Oracle's mathematical or numeric functions: i.e. SUM, MIN, MAX, COUNT, etc., does it also do division within a field? I.e. COUNT(*) of one field divided by COUNT(*) with a HAVING or WHERE attatched to it? (or vice versa rather)
    In other words, if I have 65 records, and it's maybe a yes-no field, and maybe 43 have the value "yes", for example, can it divide the count total of 43 by 65 to render a percentage value, or does that just need to be handled by whatever supplementary programming language (i.e. java, C++, Perl, etc.) by creating a double or int value and the like?
    Forgive me if this seems obvious, as I'm not totally versed in Oracle, but realize it has many capabilities.
    Thanks!

    Something like this ?
    TEST@db102 SQL> select a, b, a/b from
      2  (select count(*) a from emp where deptno=30),
      3* (select count(*) b from emp)
    TEST@db102 SQL> /
             A          B        A/B
             6         14 .428571429
    TEST@db102 SQL>                              
    [pre]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Can text be displayed in a formula column using mathematical functions?

    I am working with Financial Reports version 11.1.1.3 and I'm trying to accomplish the following scenario:
    Column D is a data column
    Column E is a text column containing the value "TEXT"
    Column F is a formula column with the following formula: IfThen([D]=0,[E],[D])
    What I want to see happen is if the value in column D is 0 then I want the value "TEXT" to appear in column F, otherwise; I want to show the data value that is in column D. Is it possible to display text in a formula column and if so, what is the syntax for that? Or does anyone have another way to accomplish this? Any help would be appreciated.
    Thanks!

    Short answer: No.
    For your particular issue, I would suggest putting your TEXT value in the #zero and #missing overrides in Report Studio.
    In general, Hyeprion Reporting does not do any real text validations or functions like you could use in Excel.

  • Problem in mathematical Functions

    Hi All,
    I am using a mathmatical function FRAC but getting error
    Field "FRAC" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement.
    getting this error for any of the functions like CEIL, FLOOR etc.
    My Statement is -
    lv_mmm = frac(lv_time).
    Do i need to include something to get it working?
    Thanks,
    Nilanjana
    Edited by: nilanjana sinha on Aug 25, 2010 12:30 PM

    Hello,
    try:
    lv_mmm = frac( lv_time ).
    You have to insert spaces before and after lv_time. This is valid for all functions.
    regards,
    Pedro

Maybe you are looking for

  • Costing in case of ETO Scenario

    Hi Experts, We have ETO scenario. There is sales order with reference to project  and absed on that production for In House Produced materials ( FG, HALB) and procurement for  some HALB, Raw Material will happen.PS<  moduel alongwith SD and PP are in

  • Setting font-family at Page level in xsl ???

    Hi All, I have a question regarding setting the attribute font-family at page level. I can use this attribute at block level , Is it possible to use it at Page level ie (simple-page-master). In simple terms use the same font across the page without h

  • Script Errors in TOC from RoboHelp 9

    Hello, all. I can usually find the answer to my problems by searching existing threads, but I can't seem to find a solution this time. I recently upgraded from RoboHelp 7 to 9.0.2.271. I have published WebHelp locally and then checked files in to a T

  • Web Services - PHP client

    Hi, I'm trying to connect a php script using NuSOAP to a web service implemented with Netbeans 5.5 and runnig on Tomcat 5.5.20 The web-service provider: package server; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebServic

  • 1 transaction, 2 proxies ?

    Hi experts, is it possible from one transaction 2 trigger 2 different proxies and then 2 different mappings ? If yes, could you tell me how ? Many thanks in advance, Jamal