Highlight the last entryitem of in a query

Hello

I have the following challenge :

I would like to highlight the latest news or articles today on our intranet home page.

On this page, I created a query that shows the 5 latest news in a database, with a link to each article.

And also a link to all the other elements:

Here is a sample of clearify what I mean.

latest news
19/03/2010 - article 21 ( )NEW)
18/03/2010 - article 20
15/03/2010 - article 19
03/05/2010 - section 18
02/01/2010 - article 17
More news...  (20 items in total)

This is how it is set up right now:

< cfparam name = default "PageNum_NieuwsOverzicht" = "1" >
< name cfquery = "NieuwsOverzicht" datasource = cachedwithin = "#CreateTimeSpan (0,0,1,0)"Intranet"#" >
SELECT NieuwsDatum, NieuwsKop, NieuwsId
OF Nieuws
ORDER BY NieuwsDatum DESC
< / cfquery >
<! - repeat region - >
< cfset MaxRows_NieuwsOverzicht = 5 >
< cfset StartRow_NieuwsOverzicht = Min ((PageNum_NieuwsOverzicht-1) * MaxRows_NieuwsOverzicht + 1, Max (or euwsOverzicht.RecordCount, 1)) >
< cfset EndRow_NieuwsOverzicht = Min (StartRow_NieuwsOverzicht + MaxRows_NieuwsOverzicht-1, OT NieuwsOverz. RecordCount) >
< cfset TotalPages_NieuwsOverzicht = Ceiling(NieuwsOverzicht.RecordCount/MaxRows_NieuwsOverzicht) >
< cfset NieuwsId = NieuwsOverzicht.RecordCount >

How can I select (and somehow the format) the last element of in a query?

Looks like you want to highlight the first line of the request:


#NieuwsKop #-#NieuwsDatum #- (NEW)

--

Mack

Tags: ColdFusion

Similar Questions

  • Don't forget the last entries in form af:query after navigating to the search page

    12.1.3 JDev

    Let's say I have a BTF with search page jsff with an af:query and result table. The user can navigate on this page after executing the search and do something else in the application. What I want to achieve is if the user navigates to this search page, that the previous entries of the form af:query will be pre-filled.

    Does make sense?

    corresponding AF liaison component: Query has an InitialQueryOverriden property defaults to false.

    You must set to true.

    More details here:

    http://www.jobinesh.com/2009/11/displaying-pre-executed-query-result-in.html

  • SQL query to get the NULL records after the last matching flag

    I have a xx1 table with id and flag columns. So I want the data in this table, after the last flag matched. I want that data to id 7 in the rooms. Even if the id 2,3,5 are null flag 'Y' was at 6. ID so I need a query to get the data of the xx1 table after the last correspondence flag (from 7 to 9 id).

    SQL > create table xx1

    2 (identification number,

    3 flag varchar2 (10));

    Table created.

    SQL > insert into xx1 values (1, 'Y');

    1 line of creation.

    SQL > insert into values xx1 (2, null);

    1 line of creation.

    SQL > insert into values xx1 (3, null);

    1 line of creation.

    SQL > insert into xx1 values (4, 'Y');

    1 line of creation.

    SQL > insert into values xx1 (5, null);

    1 line of creation.

    SQL > insert into xx1 values (6, 'Y');

    1 line of creation.

    SQL > insert into values xx1 (7, null);

    1 line of creation.

    SQL > insert into values xx1 (8, null);

    1 line of creation.

    SQL > insert into values xx1 (9, null);

    1 line of creation.

    SQL > select * from xx1.

    FLAG OF THE ID

    ---------- ----------

    1. IS

    2

    3

    4. IS

    5

    6. IS

    7

    8

    9

    9 selected lines.

    SQL >

    Hello

    user11164339 wrote:

    Hi Frank - when I run the query, I don't see the results data.

    I get

    FLAG OF THE ID

    ----- ----------

    7

    8

    9

    What you do differently?

  • [ADF, JDev 12.1.3] To run a query on the fly is always necessary to define a VO? How to get the Id of the last line inserted in a VO...

    Hallo,

    Sometimes, in the code for my application, I need to run smaller queries to retrieve data from the database.

    I wonder if for these queries, it is necessary to define a View object or if I can avoid this for example creation and execution of a VO on the fly.

    In this case I would not define a VO, given that queries will be never used to display data, but only for the internal logic.

    A use case, I want to solve it next.

    I would like to create a function to be used after validation for last inserted record by a user in a TableVO.

    For example

    Select the Id of the Table where UserId =? and Type =?

    The query should be run in a managed bean...

    public String okButton_action() {}

    OperationBinding operationBinding is BindingsUtils.getBindings () .getOperationBinding ("Commit");.

    Object result = operationBinding.execute ();

    If (! operationBinding.getErrors () .isEmpty ()) {}

    Error handling

    return;

    }

    Here, I need to:

    1. run the query to get the Id of the last inserted record

    2 call the setCurrentRowWithKey on the TableVO to update the display

    and get the Id (identity/auto-increment) than the database

    assigned to the field

    return "return";

    }

    If I can create a function that creates / runs the VO on the fly and return the value ID... It is best to create it in a class of public services or in the implementation class TableVO?

    I need to get the Id of the last line inserted since the ADF is not able to manage MS SQL Server identity fields (it seems that REFRESH AFTER INSERT cannot be used with non - Oracle DB).

    Any notice will be welocome.

    Thank you

    Federico

    The query should be run in a managed bean...

    Much better to execute the query in the template project.

    Example query: http://amit-adf-work.blogspot.com/2013/09/how-to-execute-sql-using-adf-application.html

    If I can create a function that creates / runs the VO on the fly and return the value ID... It is best to create it in a class of public services or in the implementation class TableVO?

    If you have the function that accepts the SQL as a parameter, then this should go to class util.

    Dario

  • How to get the last row and the sum of all columns in a query

    Hello

    is there a way to get the last record for a column and the sum of all the Archives to another column in the same query.

    Best regards

    You must set your needs correctly volunteers to help here...

    Your data are not good enough to bring you a precise solution. Purpose, you do not have a column, which draws a distinction between the first and the last entry.

    The solution becomes easy based on your design.

    I introduced a grouping called 'id' column and a time column called 'time_of_insert' (only this way you can say with confidence that you can differentiate between the first and last (also a foolproof solution) - you can possibly use sequence (instead of date but if you say that you can insert two lines at the same time) ((and then likely sequence would be a better choice to differentiate instead of a timestamp field) etc...)

    With your sample data, something like this can be done to get the desired results.

    -----------------------------------------------------------------------------------------------------------------------

    WITH dataset AS

    (SELECT 1 id, 10 used, 8 remain, systimestamp + 1/24 time_of_insert FROM DUAL

    UNION ALL

    SELECT the 1 id, 1, 7, systimestamp + 2/24 FROM DUAL

    UNION ALL

    SELECT the id 1, 2, 5, systimestamp + 3/24 FROM DUAL

    UNION ALL

    SELECT 1 id, 1, 0, systimestamp + 4/24 FROM DUAL

    UNION ALL

    SELECT 1 id, 0, 0, systimestamp + 5/24 FROM DUAL

    UNION ALL

    SELECT the 1 id, 1, 4, systimestamp + 6/24 FROM DUAL)

    SELECT *.

    (SELECT SUM (used) ON sum_all)

    FIRST_VALUE (stay)

    COURSES (PARTITION BY id ORDER BY time_of_insert DESC)

    last_row

    Of THE dataset)

    WHERE ROWNUM = 1;

    Output:

    ------------------------

    SUM_ALL LAST_ROW

    ------------------------------

    15                  4

    See you soon,.

    Manik.

  • How can I find the last selection OR has highlighted it selection?

    When I select some elements in indesign I have the option of 'command + click' to highlight one selections. How can I find this item highlighted in the script?

    OR

    How I'll get the last item selected in indesign.


    I'm writing a script that relies on certain properties of the element highlight or the last selected item.


    Thank you


    Screen Shot 2014-08-01 at 12.17.03 PM.png

    Thank you myDavey. It's not exactly what I was looking for, but he had good information on something else, I'm trying.

    I found the solution to my problem. This highlighted selection apparently called the object 'key '.

    And it can be used in the script as app.selectionKeyObject. This solves what I was looking for.

    And you can find the last selection by selecting the last item in the selection table.

  • How to calculate/display time passed since the last execution of the query

    Hi all
    I use Studio Edition Version 11.1.2.1.0 Jdeveloper, ADF BC, and ADF Faces Rich Client.
    In my page, I have a table and a binded button to perform the action so that the user can re run the query whenever it wants.
    I need to show the time elapsed since the last execution of the request for a few minutes and reset this value whenever the user clicks on the button. This value must be updated automatically on the page as the elapsed time.
    I don't want to use the af:poll component, because this will prevent the session timeout.

    Jaja,

    In the example above, the first js method is called when the button is clicked (and continues to take into account automatically on it). If your logic "run query" occurs during the loading of the page, you can trigger the same method with a clientListener of the load at the level of the document type.

    If this isn't your condition, can you clarify

    How the output value will be maintained updated without clicking the button.

    Arun-

  • IF NEW VARIABLE in SQL QUERY, DISPLAYS as the LAST COLUMN + rpad does not

    Hello all and thanks in advance.


    (1) if I add a new variable to my sql query to select a column, which was already on the table, it shows it in the report of the table as the last column on the right. In other words, if I add "the street" to

    something like city, postal code, street, store, Manager, etc., instead of placing the Street between CP and the Bank, the place like I said as the last column on the right.


    (2) when the values entered in the cells of the tables, Yes, they extend to their length, but, only if it is a Word. If it is two, as when I enter the value of 'very good '.

    then two lines as well as by a newline within the cell, for example, which in fact too high the rank. I tried sdap spaces with rpad but this did not work. something like rpad (stock, 20,' ')

    I have to say that the table is in the same page where there is a form, as the table grows in length it's actually squeezing the form on the left.


    (3) rpad did not work with the simpler syntax, but less would be with what I need, because it turns out that I am using DECODE to perform a conversion between the displayed value and

    value returned in my select list of values, something like: DECODE (TO_CHAR (stock), '1', 'Black', '2', 'Average', '3', 'good', '4', 'Very good', null) AS stock

    so, I tried to put the rpad there in several places, but either he gave the parse error or it has left empty do not pick up all the values in the column.


    Thank you very much

    Alvaro

    Alvaro

    (1) this is the standard behavior of the constructor of the apex. You can change the order of display with arrows in the report column attributes.

    (2) you have to play with the style of the column attributes to accomplice this. For the style of the instance = "" white-space: pre; ' in the attributes of the element column attributes. " White-space: normal would be put on several space (' ') 1. So no matter how you add with rpad, they will display as 1.
    Set a width or as attribute in a class style for this column.

    Nicolette

  • Help with the query to return the last possible value

    Can someone please help me to create a query for the situation below?

    Table: TABLEA
    Columns:
    FACID VARCHAR2 (10),
    DEPTID VARCHAR2 (10),
    CHARGENUMBER NUMBER (10)

    I have the following data:

    A, B, 1
    A, B, 2
    C, D, 3
    C, D, 4

    I will return the following:

    A, B, 2
    C, D, 4

    In other words, I would return the last possible CHARGENUMBER for FACID and DEPTID.
    The table has no index, and it is responsible for a worksheet in that order.

    Thank you very much!

    Hello

    If you have a TIMESTAMP column, called entry_dt, you can use a Top - N query like this to find the last x entries.

    WITH  got_rnum  AS
    (
         SELECT  my_table.*
         ,     RANK () OVER (ORDER BY entry_dt DESC)     AS rnum
         FROM     my_table
    )
    SELECT     *     -- or list all columns except rnum
    FROM     got_rnum
    WHERE     rnum     <= x
    ;
    

    It is very common to have a trigger to ensure that columns like entry_dt are met.

    If you have only one statement that inserts with hundreds of lines, they can all have the same entry_dt. (The value of SYSTIMESTAMP is constant throughout a statement, even if it takes a few seconds).
    The above query uses RANK, so if you tell him you want the last 10 entries, it can return more than 10, because it includes all lines with exactly the same entry_dt as the 10th. If you want to exactly 10 rows returned, even if there is a tie for 10th place, then use ROW_NUMBER instead of RANK; the rest of the query is the same.

  • Format the first and the last record of query result

    Hello
    I have the following query

    < tt > select 1 seq, "This is the first record" data from dual union of all the
    Select 2, 'Data ' | tNom tab Union all
    Select 3, "It was last last record" double
    order by 1 < /tt >

    When I have the coil this summary to a listfile with col seq noprint option I get:

    This is the first record
    Data MLA_ACCESS_LIST
    Data MLA_APPLICATIONS
    Data MLA_VPD_PCK
    Data MLA_VPD_TABLES
    It was the last last record

    But I want to:

    It's first record MLA_ACCESS_LIST
    Data MLA_APPLICATIONS
    Data MLA_VPD_PCK
    MLA_VPD_TABLES it was save finally last record

    I tried with 1 statement with the use of lead and lag, because first and last record stand the other result record. But I get ORA-30484: lack of specification of the window for this function

    Is this possible with 1 statement or am I've sentenced to modify the results by myself?

    Thank you Auke

    Select row_number() case above (tNom control)
    When 1 then 'it's the first record
    end | tNom |
    -case row_number() over (order by desc tNom)
    When 1 then 'it was the last record. "
    end
    tab
    order by tNom

    HTH

  • Query to get the last change in the particular column

    Hello

    [Update]
    I need help to find the last change to a particular to a table column.

    tell the table as
    t_address (phone_number, first_name, user_id, change_date)

    I need to find what was her last phone number change happened.
    Well, the date of change is updated for any changes in this table. I want to understand the change_date only when a particular field has changed (from the previous value). It seems a little complicated for me.

    t_address (phone_number, first_name, user_id, change_date)

    say for any change of phone_number, name it will be an entry in this table t_address. and change_date will be the inserted date.

    say

    USR_ID phone_number name change_date
    Hari 123 Henderson 12/12/2011
    Hari hari 123 12/11/2011
    Hari hari 345 12/10/2011

    now my requirement is to get 12/11/2011 as on that particular date, the phone number has changed from previous value.


    Please suggest.

    Published by: user7807429 on Sep 10, 2012 11:51

    Hello

    WITH t_address AS (
    SELECT 'hari' usr_id, 123 phone_number, 'harinath' first_name ,DATE '2011-12-12' change_date FROM dual UNION ALL
    SELECT 'hari' usr_id, 123 phone_number, 'hari' first_name ,DATE '2011-12-11' change_date FROM dual UNION ALL
    SELECT 'hari' usr_id, 345 phone_number, 'hari' first_name ,DATE '2011-12-10' change_date FROM dual
    )
    SELECT  usr_id
           ,phone_number
           ,prev_phone_number
           ,first_name
           ,change_date
    FROM    (
        -- Select only the rows where the phone number changed
        -- and max phone change date for each user
        SELECT  usr_id
               ,phone_number
               ,first_name
               ,change_date
               ,prev_phone_number
               ,MAX(change_date)
                OVER (PARTITION BY usr_id
                      ORDER BY change_date
                      RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
                      ) max_change_date
        FROM    (
            -- Select the data together with the phone number of the previous row
            SELECT  usr_id
                   ,phone_number
                   ,first_name
                   ,change_date
                   ,LAG(phone_number)
                    OVER (PARTITION BY usr_id
                          ORDER BY change_date
                          ) prev_phone_number
            FROM    t_address
            )
        -- check for difference with decode because phone_number might be NULL
        WHERE   DECODE( prev_phone_number, phone_number, 1, 0 ) = 0
        )
    WHERE   change_date = max_change_date;
    
    USR_ID PHONE_NUMBER PREV_PHONE_NUMBER FIRST_NAME CHANGE_DATE
    ------ ------------ ----------------- ---------- -----------
    hari            123               345 hari       11.12.2011 
    

    You can include the current value if you join more intimate in the select t_user.

    Concerning
    Marcus

  • FAQ (29): why the "See the last SoftPaqs" button grayed out?

    When I'm in the mode 'All products' or "Building Driver Pack", "Show the last SoftPaqs" button is gray. How to enable this feature for SDM will show me the latest versions of the SoftPaqs for my selected models?

    In the modes of 'Building Driver Pack' and 'All products', you have the ability to check more than one model. Unfortunately, showing the latest version of a SoftPaq for more than one model is problematic because the same version of a SoftPaq maybe not the one which is responsible for all the models selected that makes the application unnecessary and ambiguous.

    Just think about it for a second. If we had a model (let's call ModelA) 5 years ago and another model who is only 1 year old (let's call ModelB) selected in SDM. Keep in mind that computer models of different years will probably have material differences that require different hardware drivers. Also note that this could be the case even if the models were of the same year. Furthermore, models most recent software qualification only goes back a number of years. It could very well be that the software can run on older models, but if HP do not qualify and test it, HP will not associate the new version of the SoftPaqs with older models.

    So, what does the request: "Show me the latest versions of SoftPaq for some models ModelA and ModelB" really means? We asked this exact question to various people and two completely DIFFERENT responses are returned. The answer seems to be influenced by the different needs of the Organization to which the respondents belonged to.

    For some, the answer was: ' show me the most recent SoftPaq who qualified for BOTH models. This is known as a query "AND". This query would only show what are the common SoftPaqs between ModelA and ModelB, but would show NO SoftPaqs, who were qualified for only one and not the other.  With this query, most of models that are selected, the lower number of SoftPaqs appears.

    But for other respondents, the answer was ' show me the lastest Softpaq is qualififed for EITHER model; which is a query "GOLD". This query would show all the SoftPaqs associated with each model. But it is not clear if each SoftPaq was qualified for ModelA, ModelB or for both. This request seems to be too broad, because the models have been selected, more likely it is that a SoftPaq would appear even if she wasn't qualified for a model on the list only.

    So, to illustrate this, imagine the following scenarios...

    Scenario 1

    We have three SoftPaqs. SoftPaq1 qualified for the ModelA and ModelB, SoftPaq2 is ONLY responsible for ModelA and SoftPaq3 is ONLY responsible for ModelB. What SoftPaqs should appear as the "last SoftPaq ModelA and ModelB"?

    Answer:

    Query AND: SoftPaq1 because it is "the latest version of a SoftPaq who qualified for BOTH models.

    GOLDEN request: SoftPaq2 and SoftPaq3 because everyone is "the latest version of a SoftPaq for at least one model.

    Scenario 2

    What happens if the SoftPaq3 did not exist?

    Answer:

    Query ANDoftPaq1 because it is "the latest version of a SoftPaq who qualified for BOTH models.

    OR queryoftPaq1 and SoftPaq2 because everyone is "the latest version of a SoftPaq for at least one model.

    Scenario 3

    What happens if the SoftPaq1 did not exist?

    Answer:

    AND query: No. SoftPaq is qualified for BOTH models

    GOLDEN request: SoftPaq2 and SoftPaq3 because everyone is "the latest version of a SoftPaq for at least one model.

    Add more models and SoftPaqs and results gets confusing real fast. Therefore, to avoid confusion, it was decided that the "View the last SoftPaqs" button would be disabled if more than one model was chosen because it is the only case where "See the last SoftPaqs" is not ambiguous. Thus, the "View the last SoftPaqs" button is available, if only a model (and OS and language) are selected.

    If you have several patterns that you manage, and you want to use the button "See the last SoftPaqs", please enjoy SDM configurations and save a configuration for each model. For more information on SDM configurations, please see using SDM.

  • Extract the first line containing "critical" or "E-Stop" of the last avalanche of line

    Hi all

    I'm watching some test systems by analyzing their audit files.

    In this case, the platform generates several line 100 files in a specific folder. The code below is to find the last file and extract the contents of the last line of the last file.

    Unfortunately, when an error occurs, the main software generates not only one entry, but an avalanche of lines [not a specific quantity of them, depending on how much the alarms are resolved] and I'm now ideas of how I could identify and the contents of the first line containing "Criticism" or "E-Stop" to exit from this avalanche [line avalanche started 22.27].

    As an example, the above program is extract the yellow line, while I need information from the blue line.

    Any idea on how I can do this?

    See you soon,.

    You can add this snippet to the top of your existing code.  I changed the indicator table to a table so I could highlight the line.

  • Highlight the strange performance - 2013sp1

    Hello

    I just installed 2013SP1 ICB and opened a project I've been working on lately.

    I had the last version 8.5.1.

    The project is well open/built/run.

    But when I set a few breakpoints and debug the code the backtrace highlighted seems strange.

    See different local screenshots attached.

    The editor preferences that can be associated with: tab length = 2 / console style = allman / last 2 of the 3 boxes are active in the region tab of the Editor Preferences dialog box.

    If I open a sample project from examples (Intgraph for example) I observed the same behavior.

    Closing/re-opening the CVI IDE or 'clean' ing ing and 'rebuild' makes no difference.

    Is this a known problem already?

    Hi Eren,

    I read your post more carefully, and I saw that you wrote that the last 2 of the 3 boxes are active in the region tab .

    Indeed, in this case the culmination is always bouguous, even if you reload the file.

    You don't see the bad behavior on the examples because the files are indented with tabs and you do not save files to replace tabs by spaces. If you make a small modification to a file and debug again you will see this behavior because the file is saved with spaces.

    The debugger uses the saved file that contains sapces, while the Publisher is has tabs in there and so the bad nail.

    Unfortunately it is not a work around for this case, the only solution is to uncheck "Convert spaces to tabs when loading files"

    I apologise for the inconvenience.

    Constantin

  • Highlight the current row in a listbox and auto control. position of the ScrollBar

    How can I automatically highlight the assets on line in a listbox control and automatically scroll the vertical scroll bar in the active position (last)?

    Thank you

    What of the attached amendment?

Maybe you are looking for

  • Satellite L300-29 t replacement battery UK?

    It is listed as 10.80V PA3534U-1BRS 4400mAh but there are so many places to go away. What is the cost of a real and who would buy you from? Same question for a compatible good?

  • EA60-155: display brightness adjustment does not

    I have a laptop Equium EA60-155, and recently, the Fn + F5 and Fn + F6 keys do not work.I looked into the different 'tools' installed and checked the user manual, but have been unable to find a solution.Any help would be appreciated...

  • login password field fill

    I have an end 2013 27 "iMac El Capitan 10.11.2 running. The connection password field filled with erroneous stars sometimes, when I wake it from sleep mode. Sometimes its OK sometimes not. Because it was intermittent, I figured though it might have b

  • Why are there at - it such a delay, write and read a PWM signal to digital input?

    Hello!  I am trying to read and take action on a PWM signal.  The equiptment I'll have access to: 9201, 9425 and cDAQ-9172 chassis of NOR. That's kind of what I'm experimenting with now (I have tested with a device USB 6211).  Someone at - it a bette

  • I can't activate Windows XP.

    You will need to contact the Activation Center. XP Reinstall due to a hard drive failure. I was well up to the activation step where he told me I had already activated. That I had a couple of years. Instructions to open the Activation Wizard do not w