Insert each item in a comma delimited textfield as its own record?

I have a textfield where users may input comma delimited text
such as keywords. I want to insert each keyword into its own
records.

On a side note, you can do multiple INSERTS in one cfquery
tag in two different ways.
1. Put the loop inside the cfquery tag but around the INSERT
statement, and put a semicolon after the insert statement. (But
it's probably not good practice since I think I ran into a limit
when trying it on an MS SQL table.)
2. Perform one INSERT statement with multiple sets of values.
(See Andy Jarret's, post at
http://www.andyjarrett.co.uk/andy/blog/index.cfm?mode=entry&entry=CC4DC627-3048-28EB-0E871 4AA882D3428)
Also it looks like Pete Freitag tried out "...a couple hundred
thousand rows..." with Andy's method on MySQL and got an error. (
http://www.petefreitag.com/item/379.cfm)

Similar Messages

  • How to insert more items for each tab in WAD  7.0

    Hello to everyone,
    My problem is confined to the WAD 7.0
    I would like to insert 4 different queries into a new Web Template.
    Two of them have to stay in one page and the others in one page each; therefore, the result would be a Web Template with three tabs.
    Unfortunately the system creates automatically four different tabs with one query each.
    Anybody knows how to insert more items in one page/tab?
    Thank you very much
    Savino Pompa

    Hi Savino
    In the WAD bring up the properites of the tabstrip_container web item, under the Internal Display group in the Tab Panel List, create 3 tabs, then drag 3 contatiner_layout web items into the tab web item.
    In each conatiner item drag the analysis web item, 2 in the first container, then 1 each for the others, then point each analysis web item at a dataprovider(query).
    Setup the contatiners so that the analysis items displays, to do this in the container properties create a row then on the following screen a column and then set the Subordinate web item to the analysis item, these web items control layout and are useful for dealing with multiple web items, for the first tab with 2 queries you will need to play with the layout, either 1 row 2 column or 2 row 1 column.
    For each tab you created add the corresponding contatiner as the Subordinate Web Item in the Tab Panel parameters for each tab.
    Hope this helps
    Josh

  • Pivot Table, "Insert Page Break After Each Item" Setting Only Works for the First Item Change

    I have a flattened pivot table generated from Powerpivot and I would like to insert a page break for each change in the row item.
    When I use the pivot table Field Settings>Insert Page Break After Each Item, Excel inserts the first page break then returns to normal pagination for the rest of the output.
    Is there another setting required to maintain the page breaks after the item change?
    Thanks.

    We are experiencing the same problem. Did you ever find a solution?

  • How to create a background image for each item in a List object

    Hello.
    I am trying to create a background image that displays whenever a user posts something to a list.  For example when a user posts text it would appear in a list.  The new item in the list would contain a specific background image with the users text appearing on top of the background image.  I do not want a background image for the entire list, rather each item within the list.
    I am not sure how clear this is so I added an image below.  When a user enters text in and clicks the "post-it" button their text would appear below with the sticky note background. 
    I am not sure which list type would be best for this problem or how to create insert the image, so I am open to suggestions. 
    Thank you for your help.  Any advice or guidance will be greatly appreciated!

    Hi
    the easiest way would be with itemRenderer.
    You have to do two things:
    1. In your list declaration use a item renderer: <mx:List itemRenderer="myRenderer"/>
    2. create a flex component myRenderer that will be the single item. This can be a canvas with a background image and a text field on it.
    When you add a new item to the list, a new myRenderer item will be created and the data property will be passed to it. So you have to put "data" in your textField.
    If you need more help try looking at Tour de Flex samples, they're pretty easy.
    Andrei

  • SSIS importing comma delimited with double quote text qualifier - Works in VS - SQL Job ignores text qualifier and fails (truncation)

    I've created an SSIS package to import a comma delimited file (csv) with double quotes for a text qualifier ("). Some of the fields contain the delimiter inside the qualified text. An example row is:
    15,"Doe, John",IS2,Alabama
    In SSIS I've specified the text qualifier as ". The sample output in the connection manager looks great. The package runs perfectly from VS and when manually executed on the SSIS server itself. The problem comes when I schedule the package to run via SQL
    job. At this point the package ignores the text qualifier, and in doing so pushes half of a field into the next available column. But instead of having too many columns, it concatenates the last 2 columns ignoring the delimiter. For example (pipes are fields):
    15|"Doe| John"|IS2,Alabama
    So the failure happens when the last half of a field is too large to fit into the next available field. In the case above _John" is 6 characters where the IS2 field is char(3). This would cause a truncation failure, which is the error I receive from the
    job history.
    To further test this I created a failure flow in my data flow to capture the records failing to be pulled from the source csv. Out of ~5000 records, ~1200 are failing, and every one of the failures has a comma delimiter inside the quoted text with a 'split'
    length greater than the next ordinal field. The ones without the comma were inserted as normal and records where the split fit into the next ordinal column where also imported, with the last field being concatenated w/delimiter. Example records when selected
    from table:
    25|"Allan Percone Trucking"|GI6|California --Imported as intended
    36|"Renolds| J."|UI6,Colorado --Field position offset by 1 to right - Last field overloaded
    To further ensure this is the problem, I changed the csv file and flat file connection manager to pipe delimited, and sure enough every record makes it in perfectly from the SQL job execution.
    I've tried comma delimited on the following set ups. Each set up failed.
    SSIS Server 2008 R2 RTM
    DB Server 2008 RTM
    DB Compat 80
    SSIS Server 2008 R2 RTM
    DB Server 2008 R2 RTM
    DB Compat 80
    SSIS Server 2008 R2 RTM
    DB Server 2008 RTM
    DB Compat 100
    SSIS Server 2008 R2 RTM
    DB Server 2008 R2 RTM
    DB Compat 100
    Since a lot of our data comes in via comma delimited flat files, I really need a fix for this. If not I'll have to rebuild all my files when I import them to use pipe delimiters instaed of commas. I'd like to avoid the extra processing overhead if possible.
    Also, is this a known bug? If so can someone point me to the posting of said bug?
    Edit: I can't ask the vendor to change the format to pipe delimited because it comes from a federal government site.

    Just wanted to share my experience of this for anyone else since I wasted a morning on it today.
    I encountered the same problem where I could run the package fine on my machine but when I deployed to a server and ran the package via dtexec, the " delimeter was being replaced with _x0022_ and columns all slurped up together and overflowing columns/truncating
    data etc.
    Since I didn't want to manually hack the DTS XML and can't install updates, the solution I used was to set an expression on the textdelimiter field of the flat file connection with the value "\"" (a double quote). That way, even if the one stored in XML
    gets bodged somewhere along the way, it is overridden with the correct value at run time. The package works fine everywhere now.

  • Comma Delimited Flat File

    I have a comma delimited flat file.  For example - "This,is,a,test"  I want to read each word and perform something with the word in Business Logic Services.  What is the best way to accomplish this?

    In Business Logic, expand the XML Functions tab.
    At the bottom you will see an action called: String List To Xml Parse
    Use that action to parse the comma seperated items and then perform any logic required on the individual items.
    What this action does is it places all the items in a Rowset/Row, Row, Row type format common to xMII.
    Enjoy!
    Note: If this was helpful please award points

  • How to split comma delimited string?

    Hi,
    I have a parameter called Id in my SP which will be of nvarchar data type and i'm going to get the multiple ids at a time seperated by commas in that parameter from the application. Now my requirement is to update a table with these comma seperated ids in seperate rows.
    For example, if i have 2 parameters called Id1 and Id2. Id1 will contain only one value and will be of int data type and Id2 will be of nvarchar data type as i can get multiple ids delimited by a comma from the application. Suppose Id1 = 1 and Id2 = '1,2,3,4'. Then I have to update id2 in the tables seperately like wherever Id1 is '1' i need to update Id2 column for 4 rows with the value 1, 2, 3, 4 respectively in different rows.
    Could you please tell me how can i do this in T-SQL? How can i split the data of parameter Id2 in 4 different rows?
    Please let me know if you did not understand the question.
    Thanks,
    Deepti

     deeptideshpande wrote:
    Hi,
    I got a similar function which is like this:
    CREATE FUNCTION dbo.fnSplit(
    @sInputList VARCHAR(8000) -- List of delimited items
    , @sDelimiter VARCHAR(8000) = ',' -- delimiter that separates items
    ) RETURNS @List TABLE (item VARCHAR(8000))
    BEGIN
    DECLARE @sItem VARCHAR(8000)
    WHILE CHARINDEX(@sDelimiter,@sInputList,0) <> 0
    BEGIN
    SELECT
    @sItem=RTRIM(LTRIM(SUBSTRING(@sInputList,1,CHARINDEX(@sDelimiter,@sInputList,0)-1))),
    @sInputList=RTRIM(LTRIM(SUBSTRING(@sInputList,CHARINDEX(@sDelimiter,@sInputList,0)+LEN(@sDelimiter),LEN(@sInputList))))
    IF LEN(@sItem) > 0
    INSERT INTO @List SELECT @sItem
    END
    IF LEN(@sInputList) > 0
    INSERT INTO @List SELECT @sInputList -- Put the last item in
    RETURN
    END
    GO
    Now when i use this in my select statement, i get data in a tabular structure as shown below:
    select
    from dbo.fnSplit('1,22,333,444,,5555,666',
    Results
    Item
    1
    22
    333
    444
    5555
    666
    Now my requirement is to insert this value in a table which has 2 columns ID1 and ID2.
    At any point of time ID1 will be an int value(only one id in that parameter) and ID2 can have multiple ids delimited by comma. With the help of above split function i can split values of ID2 into 6 different ids but i need to insert the table
    in the following way:
    ID1     ID2
    1        1
    1        22
    1        333
    1        444
    1        5555
    1        666
    How can i insert the data in the above mentioned fashion.
    Thanks,
    Deepti
    Like this:
    Code Snippet
    select 1 as id,* from dbo.fnSplit('1,22,333,444,,5555,666', ',')
    Great!!!! Wonderfull!!!... Thanks a lot.

  • Rows to comma delimited string

    Oracle version Release 10.2.0.4.0
    i have the issue with the QuerySQL
    SQL returning comma delimited rate_codes for each (outlet, id_service)
    QuerySQL:
            select
                (select ltrim(MAX(SYS_CONNECT_BY_PATH(v.service,',')) KEEP (DENSE_RANK LAST ORDER BY curr),',') ratecodes
                  from (
                         select os.outlet, rsm.id_service, os.service,
                                row_number() OVER (PARTITION BY os.outlet, rsm.id_service ORDER BY os.service) AS curr,
                                row_number() OVER (PARTITION BY os.outlet, rsm.id_service ORDER BY os.service) -1 AS prev
                           from prcsd_outletsvcs_test os,
                                ratecode_service_mapping_test rsm
                           where os.corp                = to_number(substr(:account_number,1,5))
                           and os.house                 = ltrim(substr(:account_number,6,6),'0')
                           and os.cust                  = ltrim(substr(:account_number,12,2),'0')
                           and os.outlet                = :no_outlet
                           and rsm.corp                 = os.corp
                           and rsm.rate_code            = os.service
                           and rsm.id_service           = :id_service
                        ) v
                 group by outlet, id_service
                CONNECT BY prev = PRIOR curr
                START WITH curr = 1
                ) ratecodes
            from dual;parameter account_number 0787074919903, no_outlet=2, id_service=3 returns V1,XF
    parameter account_number 0787074919903, no_outlet=2, id_service=1 returns X1
    This sql works fine, but if i enclose it with another select ... dual and the QuerySQL in cursor like
    ( the parameters account_number, no_outlet and id_service is returned from some other tables in outer loop, here i am using outer dual to simulate my situation )
    select
        :no_outlet, :id_service,
        cursor (
                    QuerySQL above
                ) ratecodes
            from dual
        ) ratecodes
    from dual;cursor output:
    parameter account_number 0787074919903, no_outlet=2, id_service=3 returns V1,XF
    parameter account_number 0787074919903, no_outlet=2, id_service=1 returns nothing
    the (outlet,id_service) with only one rate_code is not returning anything
    data creation:
    CREATE TABLE PRCSD_OUTLETSVCS_TEST
      CORP     NUMBER                               NOT NULL,
      HOUSE    VARCHAR2(6 BYTE)                     NOT NULL,
      CUST     VARCHAR2(2 BYTE)                     NOT NULL,
      OUTLET   NUMBER                               NOT NULL,
      SERVICE  VARCHAR2(2 BYTE)                     NOT NULL
    CREATE TABLE RATECODE_SERVICE_MAPPING_TEST
      CORP        NUMBER(5),
      ID_SERVICE  NUMBER(10),
      RATE_CODE   VARCHAR2(10 BYTE)
    Insert into PRCSD_OUTLETSVCS_TEST(corp, house, cust, outlet, service)
    Values(7870, '749199', '3', 1, 'X1');
    Insert into PRCSD_OUTLETSVCS_TEST(corp, house, cust, outlet, service)
    Values(7870, '749199', '3', 1, 'X2');
    Insert into PRCSD_OUTLETSVCS_TEST(corp, house, cust, outlet, service)
    Values(7870, '749199', '3', 1, 'XC');
    Insert into PRCSD_OUTLETSVCS_TEST(corp, house, cust, outlet, service)
    Values(7870, '749199', '3', 2, 'V1');
    Insert into PRCSD_OUTLETSVCS_TEST(corp, house, cust, outlet, service)
    Values(7870, '749199', '3', 2, 'X1');
    Insert into PRCSD_OUTLETSVCS_TEST(corp, house, cust, outlet, service)
    Values(7870, '749199', '3', 2, 'X2');
    Insert into PRCSD_OUTLETSVCS_TEST(corp, house, cust, outlet, service)
    Values(7870, '749199', '3', 2, 'XF');
    Insert into PRCSD_OUTLETSVCS_TEST(corp, house, cust, outlet, service)
    Values(7870, '749199', '3', 3, '94');
    Insert into PRCSD_OUTLETSVCS_TEST(corp, house, cust, outlet, service)
    Values(7870, '749199', '3', 3, 'X1');
    Insert into PRCSD_OUTLETSVCS_TEST(corp, house, cust, outlet, service)
    Values(7870, '749199', '3', 3, 'X2');
    Insert into PRCSD_OUTLETSVCS_TEST(corp, house, cust, outlet, service)
    Values(7870, '749199', '3', 3, 'XR');
    Insert into RATECODE_SERVICE_MAPPING_TEST(corp, id_service, rate_code)
    Values(7870, 1, 'X1');
    Insert into RATECODE_SERVICE_MAPPING_TEST(corp, id_service, rate_code)
    Values(7870, 2, 'XC');
    Insert into RATECODE_SERVICE_MAPPING_TEST(corp, id_service, rate_code)
    Values(7870, 3, 'V1');
    Insert into RATECODE_SERVICE_MAPPING_TEST(corp, id_service, rate_code)
    Values(7870, 3, 'XF');
    Insert into RATECODE_SERVICE_MAPPING_TEST(corp, id_service, rate_code)
    Values(7870, 4, '94');
    Insert into RATECODE_SERVICE_MAPPING_TEST(corp, id_service, rate_code)
    Values(7870, 4, 'X1');
    Insert into RATECODE_SERVICE_MAPPING_TEST(corp, id_service, rate_code)
    Values(7870, 4, 'XR');thanks for any help

    pkchan wrote:
    i added
    where
    v.outlet        = svc_rc.outlet
    and v.id_service    = svc_rc.id_serviceand comment out the assignment lines with :no_outlet and :id_service
    You misunderstand how hierarchical query works. Look at:
                         select  max(ltrim(SYS_CONNECT_BY_PATH(v.service,','),',')) ratecodes
                            from (
                                  select  os.outlet,
                                          rsm.id_service,
                                          os.service,
                                          row_number() OVER (PARTITION BY os.outlet, rsm.id_service ORDER BY os.service) AS rn
                                    from  prcsd_outletsvcs_test os,
                                          ratecode_service_mapping_test rsm
                                    where os.corp        = to_number(substr(:account_number,1,5))
                                      and os.house       = ltrim(substr(:account_number,6,6),'0')
                                      and os.cust        = ltrim(substr(:account_number,12,2),'0')
                                      --and os.outlet      = :no_outlet
                                      and rsm.corp       = os.corp
                                      and rsm.rate_code  = os.service
                                      --and rsm.id_service = :id_service
                                 ) v
                            where
                                v.outlet        = svc_rc.outlet
                            and v.id_service    = svc_rc.id_service
                                CONNECT BY rn = PRIOR rn + 1
                                START WITH rn = 1WHERE clause in hierarchical query is applied AFTER hierarchy is build. Therefore rn=1 from EACH combination is joined to rn=2 in ALL combinations and then joined to rn=3 in ALL combinations, etc. and only then WHERE clause is applied. To create proper hierarchies you need:
                            where
                                v.outlet        = svc_rc.outlet
                            and v.id_service    = svc_rc.id_service
                               CONNECT BY outlet = PRIOR outlet
                                      AND id_service = PRIOR id_service
                                     AND rn = PRIOR rn + 1
                                START WITH rn = 1Now:
    with svc_rc as
        select distinct os.outlet, rsm.id_service
          from prcsd_outletsvcs_test os,
               ratecode_service_mapping_test rsm
         where rsm.corp       = os.corp
           and rsm.rate_code  = os.service
         order by outlet, id_service
    select
        svc_rc.outlet, svc_rc.id_service,
        cursor (
                select  (
                         select  max(ltrim(SYS_CONNECT_BY_PATH(v.service,','),',')) ratecodes
                            from (
                                  select  os.outlet,
                                          rsm.id_service,
                                          os.service,
                                          row_number() OVER (PARTITION BY os.outlet, rsm.id_service ORDER BY os.service) AS rn
                                    from  prcsd_outletsvcs_test os,
                                          ratecode_service_mapping_test rsm
                                    where os.corp        = to_number(substr(:account_number,1,5))
                                      and os.house       = ltrim(substr(:account_number,6,6),'0')
                                      and os.cust        = ltrim(substr(:account_number,12,2),'0')
                                      --and os.outlet      = :no_outlet
                                      and rsm.corp       = os.corp
                                      and rsm.rate_code  = os.service
                                      --and rsm.id_service = :id_service
                                 ) v
                            where
                                v.outlet        = svc_rc.outlet
                            and v.id_service    = svc_rc.id_service
                               CONNECT BY outlet = PRIOR outlet
                                      AND id_service = PRIOR id_service
                                     AND rn = PRIOR rn + 1
                                START WITH rn = 1
                        ) ratecodes
                  from  dual
               ) ratecodes
      from  svc_rc
        OUTLET ID_SERVICE RATECODES
             1          1 CURSOR STATEMENT : 3
    CURSOR STATEMENT : 3
    RATECODES
             1          2 CURSOR STATEMENT : 3
    CURSOR STATEMENT : 3
    RATECODES
             1          4 CURSOR STATEMENT : 3
    CURSOR STATEMENT : 3
    RATECODES
             2          1 CURSOR STATEMENT : 3
    CURSOR STATEMENT : 3
    RATECODES
             2          3 CURSOR STATEMENT : 3
    CURSOR STATEMENT : 3
    RATECODES
    V1,XF
             2          4 CURSOR STATEMENT : 3
    CURSOR STATEMENT : 3
    RATECODES
             3          1 CURSOR STATEMENT : 3
    CURSOR STATEMENT : 3
    RATECODES
             3          4 CURSOR STATEMENT : 3
    CURSOR STATEMENT : 3
    RATECODES
    94,X1,XR
    8 rows selected.
    SQL> You get 94,X1,XR, but still wrong results for other rows. So get rid of that extra level of select (we already established it is the source of the bug you are experiencing):
    with svc_rc as
        select distinct os.outlet, rsm.id_service
          from prcsd_outletsvcs_test os,
               ratecode_service_mapping_test rsm
         where rsm.corp       = os.corp
           and rsm.rate_code  = os.service
         order by outlet, id_service
    select
        svc_rc.outlet,
        svc_rc.id_service,
        cursor (
                select  ltrim(SYS_CONNECT_BY_PATH(v.service,','),',') ratecodes
                  from (
                        select  os.outlet,
                                rsm.id_service,
                                os.service,
                                row_number() OVER (PARTITION BY os.outlet, rsm.id_service ORDER BY os.service) AS rn
                          from  prcsd_outletsvcs_test os,
                                ratecode_service_mapping_test rsm
                          where os.corp        = to_number(substr(:account_number,1,5))
                            and os.house       = ltrim(substr(:account_number,6,6),'0')
                            and os.cust        = ltrim(substr(:account_number,12,2),'0')
                            and rsm.corp       = os.corp
                            and rsm.rate_code  = os.service
                       ) v
                  WHERE connect_by_isleaf = 1
                    AND outlet = svc_rc.outlet
                    AND id_service = svc_rc.id_service
                  START WITH rn = 1
                  CONNECT BY outlet = PRIOR outlet
                         AND id_service = PRIOR id_service
                         AND rn = PRIOR rn + 1
               ) ratecodes
      from  svc_rc
        OUTLET ID_SERVICE RATECODES
             1          1 CURSOR STATEMENT : 3
    CURSOR STATEMENT : 3
    RATECODES
    X1
             1          2 CURSOR STATEMENT : 3
    CURSOR STATEMENT : 3
    RATECODES
    XC
             1          4 CURSOR STATEMENT : 3
    CURSOR STATEMENT : 3
    RATECODES
    X1
             2          1 CURSOR STATEMENT : 3
    CURSOR STATEMENT : 3
    RATECODES
    X1
             2          3 CURSOR STATEMENT : 3
    CURSOR STATEMENT : 3
    RATECODES
    V1,XF
             2          4 CURSOR STATEMENT : 3
    CURSOR STATEMENT : 3
    RATECODES
    X1
             3          1 CURSOR STATEMENT : 3
    CURSOR STATEMENT : 3
    RATECODES
    X1
             3          4 CURSOR STATEMENT : 3
    CURSOR STATEMENT : 3
    RATECODES
    94,X1,XR
    8 rows selected.
    SQL> SY.

  • IPhone Development, extract pos, rot, etc. in comma delimited format

    Hello Everyone,
    I'm working on an iPhone game, and the artists are supplying the animations in flash format.  I need to be able to extract the images, image positions, and image rotations in a comma delimited format as input to my iPhone OpenGL Rendering Engine.  Are there any tools that let you do this?
    Perhaps this is a really basic question, but I am new to flash programming and would appreciate your help.  Thanks.

    Extracting the stuff manually is probably what you will have to do, using File > Export > Image for each item. As far as getting the csv of each object's position you can do it in the code like this:
    import flash.display.MovieClip;
    //Add all objects you want in the array
    var theArray:Array = new Array(item1_mc, item2_mc);
    //Loop through each object and get its properties (code not optomized for real use)
    for(var i:int = 0; i < theArray.length; i++){
        var theCurObj = theArray[i];
        trace(i + "," + "," + theCurObj.x + "," + theCurObj.y + "," + theCurObj.rotation)
    Of course you will have to give unique instance names to every item on the stage for the above code to work.Once the above code runs you can then copy evertyhing in the output window into a new text file and save it as .csv
    It would be nice if there was a progam out there that would do it for you but I don't know of any. You can try swf decompilers but by the time you find one you like and fork over some money you'd probably be better off just doing it all manually. How many things do you need to extract?

  • Comma delimited formatting in Smartview

    I'm creating a report in smartview 9.3.1
    I have few columns with formulas and I have format my report (bold ,comma delimited and some color).
    The issue is when I do a refresh all the formatting remains intact except the comma delimited formatting on columns with formulas.
    I already have the "Use Excel Formatting" checked.
    Does any one run into this issue before ?

    Hi Brian,
    There are a few ways to do this:
    Using Subreports:
    1) Insert a Subreport with its datasource being the same table as the Main Report's in the Report Header.
    2) Inside the Subreport, create a formula with a code that looks similar to the below:
    whileprintingrecords;
    stringvar dates := dates + {Year} + ", ";
    Place the formula on the Details section
    3) Create another formula and place it on the Report Footer:
    whileprintingrecords;
    stringvar dates;
    Left(dates, len(dates)-2);
    4) Suppress all the sections of the Subreport, except the Report Footer
    5) Copy the record selection formula from the Main Report into the Subreport so that it returns the same records as the Subreport
    If the data for 'Authors' and 'Departments' is available for each row just like the 'Year', you can actually use the same subreport and modify the above formula by adding 'shared variables' to bring back a comma delimited string of the 'years', 'authors' and 'departments'
    Using SQL:
    This is probably the most efficient way to do this. Just write a SQL that returns the list of years as a comma separated string along with the other columns > drag and drop the column on the report header
    -Abhilash

  • Validating comma-delimited list for numeric entries

    Hi!
    I need to validate a comma-delimited list to make sure all the list items are numeric.  I could do a cfloop to loop through the list, then an IsValid() to check each entry, but that seems cumbersome, so I was wondering if there was a better way.
    Thanks!

    BreakawayPaul wrote:
    I had the idea to just do a replace() to get rid of all the commas and treat the value as one big number.  It seems to work.
    True. That is a creative test. But what if the list begins with 0 or contains negative or decimal numbers?
    If you must include those such eventualities, then you could extend the test to something like
    <cftry>
    <cfset myList="0,1,2,x">
    <cfset maxNo=arrayMax(listToArray(myList))>
    <!--- The rest of the business code goes here --->
    <cfcatch type="expression">
    <cfoutput>#cfcatch.Detail#</cfoutput>
    </cfcatch>
    </cftry>

  • Comma delimited in Sql query decode function errors out

    Hi All,
    DB: 11.2.0.3.0
    I am using the below query to generate the comma delimited output in a spool file but it errors out with the message below:
    SQL> set lines 100 pages 50
    SQL> col "USER_CONCURRENT_QUEUE_NAME" format a40;
    SQL> set head off
    SQL> spool /home/xyz/cmrequests.csv
    SQL> SELECT
    2 a.USER_CONCURRENT_QUEUE_NAME || ','
    3 || a.MAX_PROCESSES || ','
    4 || sum(decode(b.PHASE_CODE,'P',decode(b.STATUS_CODE,'Q',1,0),0)) Pending_Standby ||','
    5 ||sum(decode(b.PHASE_CODE,'P',decode(b.STATUS_CODE,'I',1,0),0)) Pending_Normal ||','
    6 ||sum(decode(b.PHASE_CODE,'R',decode(b.STATUS_CODE,'R',1,0),0)) Running_Normal
    7 from FND_CONCURRENT_QUEUES_VL a, FND_CONCURRENT_WORKER_REQUESTS b
    where a.concurrent_queue_id = b.concurrent_queue_id AND b.Requested_Start_Date <= SYSDATE
    8 9 GROUP BY a.USER_CONCURRENT_QUEUE_NAME,a.MAX_PROCESSES;
    || sum(decode(b.PHASE_CODE,'P',decode(b.STATUS_CODE,'Q',1,0),0)) Pending_Standby ||','
    ERROR at line 4:
    ORA-00923: FROM keyword not found where expected
    SQL> spool off;
    SQL>
    Expected output in the spool /home/xyz/cmrequests.csv
    Standard Manager,10,0,1,0
    Thanks for your time!
    Regards,

    Get to work immediately on marking your previous questions ANSWERED if they have been!
    >
    I am using the below query to generate the comma delimited output in a spool file but it errors out with the message below:
    SQL> set lines 100 pages 50
    SQL> col "USER_CONCURRENT_QUEUE_NAME" format a40;
    SQL> set head off
    SQL> spool /home/xyz/cmrequests.csv
    SQL> SELECT
    2 a.USER_CONCURRENT_QUEUE_NAME || ','
    3 || a.MAX_PROCESSES || ','
    4 || sum(decode(b.PHASE_CODE,'P',decode(b.STATUS_CODE,'Q',1,0),0)) Pending_Standby ||','
    5 ||sum(decode(b.PHASE_CODE,'P',decode(b.STATUS_CODE,'I',1,0),0)) Pending_Normal ||','
    6 ||sum(decode(b.PHASE_CODE,'R',decode(b.STATUS_CODE,'R',1,0),0)) Running_Normal
    7 from FND_CONCURRENT_QUEUES_VL a, FND_CONCURRENT_WORKER_REQUESTS b
    where a.concurrent_queue_id = b.concurrent_queue_id AND b.Requested_Start_Date <= SYSDATE
    8 9 GROUP BY a.USER_CONCURRENT_QUEUE_NAME,a.MAX_PROCESSES;
    || sum(decode(b.PHASE_CODE,'P',decode(b.STATUS_CODE,'Q',1,0),0)) Pending_Standby ||','
    >
    Well if you want to spool query results to a file the first thing you need to do is write a query that actually works.
    Why do you think a query like this is valid?
    SELECT 'this, is, my, giant, string, of, columns, with, commas, in, between, each, word'
    GROUP BY this, is, my, giant, stringYou only have one column in the result set but you are trying to group by three columns and none of them are even in the result set.
    What's up with that?
    You can only group by columns that are actually IN the result set.

  • Get Latest Entry for each Item

    I have a table that has items with multiple entries per item.  Each entry has a date of when it was entered.  I want to get unique entries with the latest date. For example,
    From this:
    item
    date
    item1 12/13/2014
    item1 12/15/2014
    item2 12/10/2014
    item2 12/19/2014
    To this:
    item
    date
    item1 12/15/2014
    item2 12/19/2014
    Thanks in advance.

    Give this a try:
    DECLARE @items TABLE (itemName VARCHAR(20), itemDate DATE)
    INSERT INTO @items (itemName, itemDate) VALUES ('item1', '12/13/2014'),('item1', '12/15/2014'),('item2', '12/10/2014'),('item2', '12/19/2014')
    SELECT *
    FROM @items i
    WHERE i.itemDate = (
    SELECT MAX(itemDate)
    FROM @items
    WHERE i.itemName = itemName

  • How to update a table with the time of insert instead of time of commit

    dear,
    i have 10 record at source side which needs to be injected in a target table ;
    the record creation date is injected with the systimestamp -
    when commiting it takes for all the same timestamp for all records( at commit time ) however I would like to insert the timestamp at INSERT moment to have a unique timestamp - id est at INSERT time.
    Can anyone please adviseN?
    Thanks
    Erik
    Edited by: 845498 on 29-aug-2012 1:36

    845498 wrote:
    dear,
    when commiting it takes for all the same timestamp for all records( at commit time ) Not true about commit time. True about same time. Function SYSDATE is always calculated once for SQL statement no matter how many times and for how many rows it is referenced. So when you issue:
    insert
      into target(insert_date)
      select sysdate
        from  source
    /All inserted rows will have same insert_date. Now keep in mind, Oracle date datatype precision is one second. So unless your insert of 10 rows takes more than a second (which would be a problem on its own), date precision will not give you what you want. You would need timestamp. But again, same as SYSDATE, SYSTIMESTAMP is called once per statement. To call it row each row and reference you need to create user-defined function:
    create or replace
      function get_systimestamp
        return timestamp
        is
        begin
            return systimestamp;
    end;
    /Now:
    SQL> select  systimestamp,
      2          get_systimestamp
      3    from  hr.employees
      4  /
    SYSTIMESTAMP                        GET_SYSTIMESTAMP
    29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.671000000
    29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
    29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
    29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
    29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
    29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
    29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
    29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
    29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
    29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
    29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
    SYSTIMESTAMP                        GET_SYSTIMESTAMP
    29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
    29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
    29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
    29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
    29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
    29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.765000000
    29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.765000000
    29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.765000000
    29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.765000000
    29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.765000000
    29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.765000000.
    .SY.

  • Ssrs 2012 export to comma delimited (csv) file problem

    In an ssrs 2012 report, I want to be able to export all the data to a csv (comma delimited) file that only contains the detailed row information. I do not want to export any rows that contain header data information.
    Right now the export contains header row information and detail row information. The header row information exists for the PDF exports.
    To have the header row not exist on CSV exports, I have tried the following options on the tablix with the header row information with no success:
    1. = iif(Mid(Globals!RenderFormat.Name,1,5)<>"EXCEL",false,true),
    2. = iif(Mid(Globals!RenderFormat.Name,1,3)="PDF",false,true),
    3. The textboxes that contain the column headers, the dataelelementoutput=auto and
       the text boxes that contain the actual data, I set the dataelelementoutput=output.
    Basically I need the tablix that contains the header information not to appear when the export is for a csv file.
    However when the export is for the detail lines for the csv export, I need that tablix to show up.
    Thus can you tell me and/or show me code on how to solve this problem?

    Hi wendy,
    Based on my research, the expression posted by Ione used to hide items only work well when render format is RPL or MHTML. Because only the two render format’s RenderFormat.IsInteractive is true.
    In your scenario, you want to hide tablix header only when export the report to csv format. While CSV file uses the textbox name in detail section as the column name, not the table header when you view the table. So if we want to hide the header row of the
    tablix, please refer to the steps below to enable the “NoHeader” setting in the RSReportserver.config file:
    Please navigate to RSReportserver.config file: <drive:>\Program Files\Microsoft SQL Server\MSRS1111.MSSQLSERVER\Reporting Services\ReportServer \RSReportserver.config.
    Backup the RSReportserver.config file before we modify it, open the RSReportserver.config file with Notepad format.
    In the <Render> section, add the new code for the CSV extension like this:
        < Extension Name="CSV"   Type="Microsoft.ReportingServices.Rendering.DataRenderer.CsvReport,Microsoft.ReportingServices.DataRendering">
            <Configuration>
                <DeviceInfo>
                   <NoHeader>True</NoHeader>
                </DeviceInfo>
            </Configuration>
        < /Extension>
    Save the RSReportserver.config file.
    For more information about CSV Device Information Settings, please see:
    http://msdn.microsoft.com/en-us/library/ms155365(v=sql.110)
    If you have any other questions, please feel free to ask.
    Thanks,
    Katherine xiong
    If you have any feedback on our support, please click
    here.
    Katherine Xiong
    TechNet Community Support

Maybe you are looking for

  • Syncing iTunes on a mac and Outlook on a PC

    Hi, I have a quick question. I have my music, videos and photos sitting on my mac at home. My outlook is on my work windows PC. If I buy an iPhone and want to sync with the mac for the music etc. and work my pc for outlook would this be possible? Tha

  • Can't close a window in html or JS

    How can I close a "child" window opened from a "main" window in html or JS without resorting to asking the user to close the "child" browser window? I think I have tried just about everything. I have tried opening the "child" window by an tag and wit

  • APIs for Flash

    I want to create an application using Flash proffessional CS5 and AS3 and then use Air for Android to port it to an Android smartphone. Can anyone tell me what APIs are available for use in Flash Proffessional CS5 with AS3 as I cant find a definitive

  • Off center printing

    I am printing multiple pages and after the first couple pages the image is skewed to the bottom left side of the page cutting of part of the bottom of the document.

  • Error :The function upload is not possible for this documentu2019

    Hi, The users are using Solution manager Help Desk system. When a specific user tries to create a message from the satellite system, and tries to upload a  document, he is unable to do so. He is getting an error message : 'The function <upload> is no