How to Add extra data in result set of cfquerry?

hi all,
I am new to cold fusion please help me
i am using the cfquery tag for executing a select query and getting the system name and system is from that........
But i want an extra system name and system id to add to the result of that query with out changing the data base ..............
please any one suggest me ...........IT's URGENT
Thanks in advance
Sudheer

You'll have to use an array and the function queryAddColumn. An example follows.
Suppose I have a result set called myQuery. There are 5 rows in it. I wish to add 2 new columns to the query, on the fly. The column names are username(type varchar) and userID(type integer)
<!--- Create array corresponding to column username--->
<cfset usernameArray = ArrayNew(1)>
<cfset usernameArray[1] = "[email protected]">
<cfset usernameArray[2] = "[email protected]">
<cfset usernameArray[3] = "[email protected]">
<cfset usernameArray[4] = "[email protected]">
<cfset usernameArray[5] = "[email protected]">
<!---
The next line adds the new column, username, to the query. That's it. Done.
The array indices correspond to the row numbers in the query.
The function queryAddColumn returns the column number for the newly added column
(in case you'll need it, which you usually wont ).
--->
<cfset columnNumber = queryAddColumn(myQuery, "username", "VarChar", usernameArray)>
<!--- Now, do the same for the next new column, userID  --->
<cfset userIDArray = ArrayNew(1)>
<cfset userIDArray[1] = "23">
<cfset userIDArray[2] = "121">
<cfset userIDArray[3] = "9">
<cfset userIDArray[4] = "76">
<cfset userIDArray[5] = "44">
<cfset columnNumber = queryAddColumn(myQuery, "userID", "integer", userIDArray)>

Similar Messages

  • How to iterate the webservice Data control result set?

    Hi all,
    How to iterate the webservice Data control result set? I have an jsff page where I am displaying the single UserDetails by webservice DataContol. As per my design requirement I should iterate the DataControl resultSet to get the user details and push the same in to Managed bean. Please help me how to do this, any sample code please to iterate the resultset and get the data from it.
       <?xml version='1.0' encoding='UTF-8'?>
       <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:c="http://java.sun.com/jsp/jstl/core">
       <c:set var="uiBundle" value="#{adfBundle['edu.syr.oim.uiBundle']}"/>
       <af:pageTemplate viewId="/templates/jsffTemplate.jspx">
        <f:facet name="fTop"/>
        <f:facet name="fCenter">
          <af:panelGroupLayout layout="scroll" inlineStyle="width:100.0%;">
       <af:panelTabbed id="pt1">
        <af:showDetailItem text="#{uiBundle.PRIVACYFLAGS}" id="sdi4">
                <af:panelGroupLayout id="pgl4" layout="scroll">
                  <af:spacer width="10" height="10" id="s3"/>
                  <af:panelFormLayout id="pfl6">
                    <af:panelLabelAndMessage label="#{uiBundle.STUDENTEMAIL}"
                                             id="plam35">
                      <af:outputText value="#{bindings.stuEmail.inputValue}"
                                     id="ot42"/>
                    </af:panelLabelAndMessage>
                    <af:panelLabelAndMessage label="#{uiBundle.STUDENTHOMEADDRESS}"
                                             id="plam39">
                      <af:outputText value="#{bindings.stuPermAddr.inputValue}"
                                     id="ot35"/>
                    </af:panelLabelAndMessage>
                    <af:panelLabelAndMessage label="#{uiBundle.STUDENTHOMEPHONE}"
                                             id="plam40">
                      <af:outputText value="#{bindings.stuPermPhn.inputValue}"
                                     id="ot37"/>
                    </af:panelLabelAndMessage>
                    <af:panelLabelAndMessage label="#{uiBundle.STUDENTCURRENTPHONE}"
                                             id="plam42">
                      <af:outputText value="#{bindings.stuCurrAddr.inputValue}"
                                     id="ot40"/>
                    </af:panelLabelAndMessage>
                    <af:panelLabelAndMessage label="#{uiBundle.STUDENTCURRENTPHONE}"
                                             id="plam36">
                      <af:outputText value="#{bindings.stuCurrPhn.inputValue}"
                                     id="ot38"/>
                    </af:panelLabelAndMessage>
                    <af:panelLabelAndMessage label="#{uiBundle.STUDENTACAINFO}"
                                             id="plam41">
                      <af:outputText value="#{bindings.stuAcad.inputValue}"
                                     id="ot36"/>
                    </af:panelLabelAndMessage>
                    <af:panelLabelAndMessage label="#{uiBundle.EMPHOMEADDRESS}"
                                             id="plam38">
                      <af:outputText value="#{bindings.empPermAddr.inputValue}"
                                     id="ot39"/>
                    </af:panelLabelAndMessage>
                    <af:panelLabelAndMessage label="#{uiBundle.EMPHOMEPHONE}"
                                             id="plam37">
                      <af:outputText value="#{bindings.empPermPhn.inputValue}"
                                     id="ot41"/>
                    </af:panelLabelAndMessage>
                  </af:panelFormLayout>
                </af:panelGroupLayout>
              </af:showDetailItem>
       </af:panelTabbed> Above is my jsff code. Here how/where to add the phase listener to paopulate the managed bean while page render. Do I need to iterate the DC to get and push the each parameter in to ManagedBean or is there any easy way to do this by EL mapping directly at jsff. Please clarify.
    Thanks
    kln

    That is what exactly I am trying right now. I am binding each of my page fragment outputText item in to backing bean and by that way trying to populate the values.
    But the issue here is, the backing bean method doesn't getting any value until I hit any of the link or the button in the fragment. While loading the page the bean set and get is null. If i hit any link or button it is filled up with the vaule. As per my design, I would like to populate the bean method along with page load before any user action. But cant able to do this!! :(
    Below is my sample code what I am trying right now
            <af:panelLabelAndMessage label="#{uiBundle.NETID}" id="plam13">
                      <af:outputText value="#{bindings.netid.inputValue}" id="ot4" binding="#{UserDataBean.netId}"/>
           </af:panelLabelAndMessage>
    backing bean ex:
    private RichOutputText netId;
    static String netidVal;
        public void setNetId(RichOutputText netId) {
           netidVal= netId.getValue() == null? "":netId.getValue().toString();
           this.netId = netId;
        public RichOutputText getNetId() {
           return netId;
        public String getNetIdVal() {
           return netidVal;
        }Thanks
    kln

  • How should i use the two results sets in one single report data region?

    Hi frnz,
     I have to create a report using the below condition...
    Here my given data  set query gives you the two result sets ,so how should i use that two result sets information in single report....when i accessing that data set query it will take the values off the first result set not for the second result set.
    without using sub report and look up functionality..... if possible
    is there any way to achieve this.....Please let me know..
    Thanks!

    You cant get both resultsets in SSRS. SSRS dataset will only take the first resultset
    you need to either create them as separate queries or merge them into a single resultset and return with ad additional hardcoded field which indicates resultset (ie resultset1,resultset2 etc)
    Then inside SSRS report you can filter on the field to fetch individual resultsets at required places. While merging you need to make sure metadata of two resultsets are made consistent ie number of columns and correcponding column data types should be same.
    In absence of required number of columns just put some placeholders using NULL
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Transfer data from Result Set (Execute SQL Task) into Flat File

    Hi to all,
    My problem is this:
     -) I have a stored procedure which use a temporary table in join with another "real" table in select statement. In particular the stored procedure look like this:
    create table #tmp
    col1 varchar(20),
    col2 varchar(50)
    --PUT SOME VALUE IN #TMP
    insert into #tmp
    values ('abc','xyz')
    --SELECT SOME VALUE
    select rt.*
    from realTable rt, #tmp
    where rt.col1 = #tmp.col1
    -) I cannot modify the stored procedure because I'm not admin of database.
    -) I HAVE THE REQUIREMENT OF TRANSFER DATA OF SELECT STATEMENT OF SOTRED PROCEDURE INTO FLAT FILE
    -) THE PROBLEM is that if I use an OLEDB source Task within a Data Flow Task I'm not be able of mapping column from OLEDB source to flat file destination. The reason for this, is that in the "Column page" of OLEDB source task, SSIS do not retrieves
    any column when we using a temporary table. The reason for this, is that SSIS is not be able to retrieve metadata related to temporary table. 
    -) One possible solution to this problem is to use an Execute SQL Task to invoke the stored procedure, store the result returned from stored procedure in a Result Set through a Object type user variable.
    -) The problem now is: How to transfer data from result set to flat file?
    -) Reading here on this forum the solution look be like to use a Script task to transfer data from result set to flat file.
    QUESTIONS: How to transfer data from result set to flat file using a script task?? (I'm not an expert of vb .net) Is it really possible?? P.S.: The number of row returned of stored procedure is very high!
    thanks in advance.

    Hi  Visakh16<abbr
    class="affil"></abbr>
    thanks for the response.
    Your is a good Idea, but I do not have permission to use DDL statement on the database in production environment.

  • How to add the date field in the dso and info cube

    Hi all.
    I am new to bi 7. in the earlier version v hav to button to add the date field. but in the bi 7 der is no option so can any body tell me how to add the date field in the data targets
    Thanks & Regard
    KK

    my prob is solved
    KK

  • How to add one date column and charecter column

    hi all,
    i have 3 column start_date(date),end_date( date),duration (varchar2)
    i am trying to add start_time and duration like this
    end_date := to_char(start_time) + duration;
    but its showing value_error
    how to add one date column and charecter column.
    Thanks

    you need something that does:
    end_date (DATE) := start_date (DATE) + <number of
    days> (NUMBER)Not necessarily, because if the duration is just a string representation of a number then it will be implicitly converted to a number and not cause an error
    e.g.
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select to_date('01/07/2007','DD/MM/YYYY') as start_dt, '3' as duration_days from dual)
      2  -- END OF TEST DATA
      3  select start_dt + duration_days
      4* from t
    SQL> /
    START_DT+
    04-JUL-07

  • How to add TIMESTAMP data type in  Enterprise Architect...?

    Hi all
    There is no data type of timestamp in Enterprise Architech. There is only
    DATE type. I have ERD prepared from Enterprise Architech. How to modify
    DATE type to TIMESTAMP type.
    How to add TIMESTAMP data type in Enterprise Architect or in ERD ?
    Thanks in advance,
    Pal

    Have you asked this question of the vendor of Enterprise Architect? They may have a later version that supports the various TIMESTAMP data types. If your ERD tool doesn't support a data type, other than talking to the vendor or working around the problem (i.e. generate DDL to a text file and edit it before applying it to the database), you're probably out of luck.
    Justin

  • How to add new data file

    Hi Friends,
    We have 4 below file systems.
    Sybase/TST/sapdata_1
    Sybase/TST/sapdata_2
    Sybase/TST/sapdata_3
    Sybase/TST/sapdata_4
    Already we have added one data file each in sapdata_1 and 2.  Sapdata3 and 4 are emptry.
    How to add new data file in sapdata3 or 4.
    Please provide syntax for creating a new data file and steps for the same.
    Regards,
    Karthik.

    Just for the record: you have here the DBACockpit documentation:
    https://websmp201.sap-ag.de/~form/sapnet?_FRAME=CONTAINER&_OBJECT=011000358700000571562012E
    And this is a sample of the extend to be executed:
    Regards,
    Victoria.

  • HT1752 I am working on a chart in paged with 7 columns. Problem has occurred with amount of row. I have completed 999 rows and it won't allow me to continue. As I need to do approx 3000+ rows, can anyone explain to me how to add extra rows. Thanks Jane

    I am working on a chart in pages with 7 columns.
    Problem has occurred with amount of rows. I have completed 999 rows and it won't allow me to continue. As I need to do approx 3000+ rows, can anyone explain to me how to add extra rows. Thanks Jane

    Try posting in the Pages forum
    https://discussions.apple.com/community/iwork/pages

  • How to add extra options for style of images.   iPad version has far more options than Mac version

    How to add extra options for style of images in pages.   iPad version has far more options than Mac version

    Thank you, you made me go look again and I realised the ones I use on the iPad are under Borders not style and they are on Mac also.  I feel a bit silly but I wouldn't have got there without your prompting.  Do you mean by "create your own"  using the borders and then saving as a style or can you create something that is not in either?
    Thanks again

  • How to add extra labels into Bridge CS5?

    Hi folks, nice to meet you all.
    I do not want to edit or rename the existing 5 existing labels into Bridge CS5. I just want to create new labels. So, I want to add extra labels to have more than 5 labels.
    Does anybody know how to add extra labels into Bridge CS5? If so, please, tell me how to do it.
    Thanks.

    You should move this post to the new Bridge forum as this one will soon die.  Here is link http://forums.adobe.com/community/bridge/general

  • How to add the Date Track Button

    How to add the Date Track Button on a customized Form ?
    1. Profile of Datetrack:Enabled = Yes
    2. All HR Forms includes the Date Trak Button
    3. On the Customized Form "Alter Date Track" can be activated from Menu :Tool --> Alter Date Track.
    I'd Like the Button to appear on button ruller.
    Thanks for help

    Rachel,
    Please review the following notes, it may be helpful.
    Note: 177733.1 - How Date Track Works
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=177733.1
    Note: 169059.1 - Understanding the Flow of Date Track Dates Through the Forms
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=169059.1

  • Does anyone know how to Add a date drop down list to a pdf file?

    Can someone tell me how to add a Date drop down list in a form

    There's no built-in function that does that in Acrobat, but there are some third-party tools that do.
    The two most known ones are by FormRouter, which is free and based on form fields (but also a bit buggy), and a non-free version created by Max Wyss, which is based on a dialog object.

  • How to add extra tab in bapi at item level

    hi developer,
    please guide me in solving this problem i.e how to add extra tab in bapi at item level .
    thanks .
    ravi

    What are you exactly asking for, I don't understand your question...
    Transaction screen, adding a tab / customer fields
    Business Object / BAPI, modifying BAPI signature, extension
    NB : The quality of an answer depends significantly on the quality of the question ...
    Regards,
    Raymond

  • How to add extra per day records based on maximum occurances in the week.

    Hello,
    I need to add extra records based on maximum occurances on a day in a week.
    For example, the result of the query shows that maximum occuances in a week 0 is 3 on so I need to add empty records in each day in that week.
    SQL QUERY:
    with  numbers as (
    SELECT ROWNUM N FROM dual 
      CONNECT BY LEVEL <=35
    ),months as (
    SELECT     ADD_MONTHS('01-JUN-10',n-1) AS current_month,
         TO_CHAR(ADD_MONTHS('01-JUN-10',n-1),'fmMonth-YYYY') AS current_month_label
    FROM numbers
    WHERE ADD_MONTHS('01-JUN-10',n-1) <= NVL(add_months('01-JUN-10', :monthcount-1),:p_month)
    ORDER BY n ASC
    ) , dates as (
    select     trunc(trunc(m.current_month, 'MM'), 'D') + n - 1 calendar_date,
         trunc((n - 1) / 7) AS week_num,
                    m.current_month as current_month
    from     numbers, months m
    where trunc(dom.schedule.calendar_begin(m.current_month) + n - 1, 'd') <= last_day(m.current_month)
    Order By week_num, calendar_date
    select dates.week_num, edate, name from (
    --week 0
    select '30-MAY-10' as edate, 'JJ' as name from dual union
    select  '31-MAY-10' as edate, 'MK' as name from dual union
    select  '01-JUN-10' as edate, 'MK' as name from dual union
    select  '01-JUN-10' as edate, 'BK' as name from dual union
    select  '01-JUN-10' as edate, 'JJ' as name from dual union
    select  '04-JUN-10' as edate, 'KK' as name from dual union
    select  '04-JUN-10' as edate, 'LA' as name from dual      union
    -- week 1
    select  '06-JUN-10' as edate, 'BK' as name from dual union
    select  '06-JUN-10' as edate, 'JJ' as name from dual union
    select  '07-JUN-10' as edate, 'KK' as name from dual union
    select  '11-JUN-10' as edate, 'LA' as name from dual      
    ) a  join dates on dates.calendar_date = a.edate   
    order by week_num, to_date(edate);CURRENT RESULT :
    WEEK_NUM             EDATE                NAME
    0                   30-MAY-10            JJ
    0                   31-MAY-10             MK
    0                   01-JUN-10             MK
    0                   01-JUN-10             JJ
    0                   01-JUN-10             BK
    0                   04-JUN-10             KK
    0                   04-JUN-10             LA
    1                   06-JUN-10             BK
    1                   06-JUN-10             JJ
    1                   07-JUN-10             KK
    1                   11-JUN-10             LAREQUIRED RESULT:
    WEEK_NUM             EDATE                NAME
    0                   30-MAY-10             JJ
    0                   30-MAY-10            null
    0                   30-MAY-10            null
    0                   31-MAY-10            MK
    0                   31-MAY-10            null
    0                   31-MAY-10            null
    0                   01-JUN-10             BK
    0                   01-JUN-10              JJ
    0                   01-JUN-10             MK
    0                   02-JUN-10             null
    0                   02-JUN-10             null
    0                   02-JUN-10             null
    0                   03-JUN-10             null
    0                   03-JUN-10             null
    0                   03-JUN-10             null
    0                   04-JUN-10             KK
    0                   04-JUN-10             LA
    0                   04-JUN-10             null
    0                   05-JUN-10             null
    0                   05-JUN-10             null
    0                   05-JUN-10             null
    --Number of Week 1 records should be 14 = (max occurances on 06-JUN-10)  * 7
    1                   06-JUN-10             BK
    1                   06-JUN-10             JJ
    1                   07-JUN-10             KK
    1                   07-JUN-10             null
    1                   08-JUN-10             null
    1                   08-JUN-10             null
    1                   09-JUN-10             null
    1                   09-JUN-10             null
    1                   10-JUN-10             null
    1                   10-JUN-10             null
    1                   11-JUN-10             LA
    1                   11-JUN-10             null
    1                   12-JUN-10             null
    1                   12-JUN-10             nullI would appreciate it if you could help me to find efficient way to achieve this?
    Thanks,
    GM
    Edited by: user12068331 on Sep 28, 2010 2:17 PM
    Edited by: user12068331 on Sep 28, 2010 2:48 PM

    Ok,
    Few things to clarify first :
    1 - How do you define week number ?
    Oracle has 2 different way for week number : normal week number (WW) and isoweek (IW).
    is your weeknumber one of those, or is it something else ?
    2 - Depending on the country the week doesn't start on the same day : in France (as most of Europe I think) first day is monday, where in the USA (as far as I know) first day is sunday.
    the to_char builtin function can display weeknumber :with a as (
    --week 0
    select 0 as weeknum, to_date('30-MAY-2010','DD-MON-YYYY') as edate, 'JJ' as name from dual union all
    select 0 as weeknum, to_date('31-MAY-2010','DD-MON-YYYY') as edate, 'MK' as name from dual union all
    select 0 as weeknum, to_date('01-JUN-2010','DD-MON-YYYY') as edate, 'MK' as name from dual union all
    select 0 as weeknum, to_date('01-JUN-2010','DD-MON-YYYY') as edate, 'BK' as name from dual union all
    select 0 as weeknum, to_date('01-JUN-2010','DD-MON-YYYY') as edate, 'JJ' as name from dual union all
    select 0 as weeknum, to_date('04-JUN-2010','DD-MON-YYYY') as edate, 'KK' as name from dual union all
    select 0 as weeknum, to_date('04-JUN-2010','DD-MON-YYYY') as edate, 'LA' as name from dual union all
    -- week 1
    select 1 as weeknum, to_date('06-JUN-2010','DD-MON-YYYY') as edate, 'BK' as name from dual union all
    select 1 as weeknum, to_date('06-JUN-2010','DD-MON-YYYY') as edate, 'JJ' as name from dual union all
    select 1 as weeknum, to_date('07-JUN-2010','DD-MON-YYYY') as edate, 'KK' as name from dual union all
    select 1 as weeknum, to_date('11-JUN-2010','DD-MON-YYYY') as edate, 'LA' as name from dual
    select to_char(a.edate,'IW') isoweek, to_char(a.edate,'WW') numweek, a.*
    from a;
    IS NU    WEEKNUM EDATE                          NA
    21 22          0 Sunday    30/05/2010 00:00:00  JJ
    22 22          0 Monday    31/05/2010 00:00:00  MK
    22 22          0 Tuesday   01/06/2010 00:00:00  MK
    22 22          0 Tuesday   01/06/2010 00:00:00  BK
    22 22          0 Tuesday   01/06/2010 00:00:00  JJ
    22 23          0 Friday    04/06/2010 00:00:00  KK
    22 23          0 Friday    04/06/2010 00:00:00  LA
    22 23          1 Sunday    06/06/2010 00:00:00  BK
    22 23          1 Sunday    06/06/2010 00:00:00  JJ
    23 23          1 Monday    07/06/2010 00:00:00  KK
    23 24          1 Friday    11/06/2010 00:00:00  LA
    11 rows selected.

Maybe you are looking for

  • Error message of Excise invoice has no matchin lines while capturing excise

    hi CIN gurus I ma facing a problem Whil capturing excise at depot. error message appearing as Excise invocie no matching lines. This problem occurs even after entering appropriate internal number in J1IG. And this problem is occuring randomly . This

  • Error while deploying an apache ant script in Jdeveloper for webcenterspace

    Hi, I am trying to deploy the ExtendWebCenterSpaces project in Jdeveloper. I right clicked the build.xml -> Run Ant Target -> clean stage. This was successful. However, when I right-click build.xml -> Run Ant Target -> deploy-shared-lib, I get the fo

  • How to implement custom Model Class in Oracle ADF?

    I am using Oracle ADF for one of my project and i am using Query component of ADF. For given tables the query component creates view objects and maps the relations. ADF uses its own custom model class for this component and it should understand the D

  • Problem when creating update rules

    Hi Friends..             I'm actually having a problem when I'm creating update rules from my cube to my Infosource. This infosource is created by Dierct update of Master data (ZXXXX) Infoobject. the error which is popping up is , Data source ZMMOBJ1

  • Help IE Problem

    My web page Main content keeps dropping to the bottom of the page any help would be appreciated here is my Web Site http://eunitedws.com/Estimate.html here is a copy of my IE style sheet @charset "UTF-8"; /* CSS Document */ <!--[if IE 5]> /* place cs