Data trimming and split it into columns for csv

Hello

I'm pretty new to CF but usually work with php. I help with a site to create an export csv of records. I am able to export csv without problem. This file is provided to a third party who asked for this format.

I need to take a field that contains the data:

EDUDIRECT or

EDUINDIRECT

and others

and strip the first three characters and place it in a single column and take the rest and place it in another column. Is there a CF function or a command that will allow me to do this?

We will always remove the first 3 and the rest goes elsewhere.

Col1 Col2

ONLINE EDU

Thanks for your help.

Most databases have string like left(), right(), and substring() functions. (The correct syntax is database dependent of course). So, you could either divide the values in your database query or use the string of CF functions. CF, you can use a combination of these functions:

Left() to enter the first 3 characters

Right() and LEN() to catch those remaining (or possibly the MID function as well)

http://help.Adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-6a 3a.html

Post edited by: == cfSearching == -.

Tags: ColdFusion

Similar Questions

  • How to split a string into columns

    Hi all

    Have a strings like this, where the delimiter is
    10:00 | x1 | 2 | RO | P | Con ausilio  | y1
    10:10 | x2 | 1 | RO |  |  | y2
    10:20 |x3 | 3 |  |  |  | y3
    10:30 |x4 | 3 | RO | N | Con aiuto  | y4
    10:40 |x5 | 1 | RO |  |  | y5
     
    how can I break it up into columns, for example, the first char(before first pipe) insert in first variable, 
    then, after first pipe,  second characters in a other column ans so on
     
    col1 := '10:00';
     
    col2 := 'x1';
    col3 := '2';
    col4:= 'RO';
    col5 := 'P';
    col6 := ' Con ausilio ';
    col7 := 'y1';
     
     
    col1 := '10:10';
    col2 := 'x2';
    .. and so on
     
    Thanks in advance

    Hello

    If you want to split the string str into 7 columns :

    SELECT  TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 1))     AS col1
    ,     TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 2))     AS col2
    ,     TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 3))     AS col3
    ...
    ,     TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 7))     AS col7
    FROM     table_x
    ;
    

    If you want to split it inot 7 variables :

    col1 := TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 1));
    col2 := TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 2));
    col3 := TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 3));
    ...
    col7 := TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 7));
    
  • Task to provision data iPlanet child to child table Sql for target recognition

    I have a multivalued attribute named "AuthzIds" from Sun LDAP through reconciliation of the target. I wanted to put this value at "MyAuthz" SQL table (child table MyUser) using GTC - DBAT.

    For this I write a task that will be attached to the 'child UD_MYAUTHZ inserted row Table"task of process 'iPlanet user. This task will be
    (1) take the child table UD_AUTHZ of the IPlanet process form data
    (2) and insert it into the child table UD_SQLAUTHZ in the form of SQL process.

    I just finished coding the above said step 1, but do not know how to code in step 2. Here is the incomplete code.


    tcFormInstanceOperationsIntf frmInstOprn = getMyUtility ("Thor.API.Operations.tcFormInstanceOperationsIntf") (tcFormInstanceOperationsIntf);
    int formVersion = frmInstOprn.getProcessFormVersion (procInstanceKey);
    long formDefKey = frmInstOprn.getProcessFormDefinitionKey (procInstanceKey);
    tcResultSet childFormDefs = frmInstOprn.getChildFormDefinition (formDefKey, formVersion);

    for (int i = 0; i < childFormDefs.getRowCount (); i ++) {}
    childFormDefs.goToRow (i);
    If (childFormDefs.getStringValue ("Structure Utility.Table Name") .equalsIgnoreCase ("UD_AUTHZ")) {}
    childKey long = childFormDefs.getLongValue ("Structure Utility.Child Tables.Child Key");
    childData (childKey, procInstanceKey) frmInstOprn.getProcessFormChildData = tcResultSet;
    for (int j = 0; j < childData.getRowCount (); j ++) {}
    childData.goToRow (j);
    I am given authz iPlanet process here.
    String sUD_MDEAUTHZ_AUTHZIDvalue = childData.getStringValue ("UD_AUTHZ_AUTHZID");
    code to put these data to process child shape UD_SQLAUTHZ SQL table. How to do?

    }
    break;
    }

    If getObjects (IPNT_USR_KEY) does not work so the user does not have the resource or your IOM installation is broken.

    I recommend checking out the USR table for the key of the user, and if this user really has this resource you need to open an SR with Oracle.

    Best regards
    / Martin

  • Convert the Period_Name in GL_JE_Lines table to a date format and then come back year

    I'm working on a data model BI Publisher and I try to convert the Period_Name in GL_JE_Lines table to a date format and then return of the year.

    The sql below works in 11i, but I can't make it work in Fusion.

    to_char (to_date (l. )) period_name , ' MON-RR ' ),'YYYY')

    Any ideas?

    Hi Jennifer,.

    To_char (sysdate, 'DDMONYYYY') in BI Publisher does not return a correct results due NLS_DATE_FORMAT/DATE_LANGUAGE settings.

    According to the standards of the I18N, NLS_DATE_LANGUAGE in the database is still hardcoded to NUMERIC_DATE_LANGUAGE. NUMERIC_DATE_LANGUAGE 'MY' in a date format mask is an integer, so you see the correct value.

    You're not supposed to publish direct SQL with fixΘe format masks (unless it's some sort of canonical format used in internal processing, including the end-user will not be), you should return language digital date to the mid range and then make the formatting of y.

    Workaround

    Try adjusting the NLS_LANGUAGE in SQL data model to override formatting from of the

    Data base and values of the Session, for ex: select to_char (sysdate, 'MON-DD-YYYY', 'NLS_DATE_LANGUAGE = AMERICAN') of double;

    I got this Oracle support after lifting a SR.

    Thank you

    Rahul.

  • I tried to download a pdf and convert them into excel, but the data in excellent is always to the image format.  How can I get the pdf data into the columns and rows?

    I tried to download a pdf and convert them into excel, but the data in excellent is always to the image format.  How can I get the pdf data into the columns and rows so that I can do the calculations?

    If you start the https://forums.adobe.com/welcome Forums Index

    You will be able to select a forum for the specific Adobe products you use

    Click on the symbol "arrow down" on the right (where it is said to see all our products and Services) to open the drop-down list and scroll

  • adding data lines and multiple columns with a form

    I need to add multiple data rows and columns to a database using a form online and don't know what would be the best method of data entry and of insertion.

    The data should look like this:

    COLUMN1 COLUMN2
    var1, var1
    var2 var2
    var3 var3
    etc...

    When you create the form do I create individual text fields for each var or would it be better to have a text field where they list the data. I don't know where to start.

    Any advice would be great.

    You can use line numbers in your domain names to associate the columns for a particular record. For example, suppose you want 5 rows enter the last names and first names:



    First name:
    First name:

    This will give you a series of areas such as lname1, lname2, fname2, $fname1, etc.

    In your form, you can also include a hidden field to indicate the number of lines.

    When you process the form, you loop again to insert each line:



    INSERT INTO mytable (name, first name)
    VALUES ("#Form ["lname"& onerow] #") ',' #Form ["Pnom" & onerow] #')

  • Use the 2nd column for the label data

    This should be easy. Online help for the numbers shows an example under Add graphics > adjust figure brands and labels.  My table is a simple 2-d column chart. In a single column, I have the weight in pounds, and in the second column, I have a date. When I have only the weight column selected in the form of data, I get a graph that is almost perfect, but there is no date label. When I try to include date data, I have a reverse relationship X and Y. Once I selected a cell as reference data, it doesn't have any way to deselect. What I want to do is chart weight against date and have the date appear as a label.

    Any advice is welcome.

    Hi innerserenity,

    I swapped the order of the columns. Column A is a column header.

    Kind regards

    Ian.

  • Dates are not appearing in the column start and Finsh of MS Project 2010. They become W31/4, W31/5, etc. Instead of 7/31/20113. How can I fix it?

    Dates are not appearing in the column start and Finsh of MS Project 2010. They appear rather like W31/4, W31/5, etc. When it should be like this: 7/31/20113. How can I fix it? Note: Dates listed do appear correctly.

    Hello Charlie,.

    You are welcome. It is what we are trying to do... help people! Thanks for letting me know that the problem is solved. Don't forget to mark it as your response so that we can spread the knowledge more far.

    Kind regards

    BearPup

  • Get the date value. MinValue and insert it into the DB

    Hello

    I'm developing an adf application using jdev11g.

    I need to recover the 3 values of page jsf (inputText 2 + 1 date. MinValue) and insert them into DB

    so I create a method in appModuleImpl:

    {public createAffAgVehNewRow (Date date, around km, veh Integer) Sub

    Get the id of the current user

    String ag = ADFContext.getCurrent () .getSessionScope ().get("idAg").toString ();

    getSequenceNumber

    oracle.jbo.domain.Number seq = new oracle.jbo.domain.Number (0);

    SequenceImpl seqImpl = new SequenceImpl ("AFF_AV_SEQ", getDBTransaction());

    SEQ = seqImpl.getSequenceNumber ();

    Insert values into the DB table

    Line r = getAffAgVehView1 () .createRow ();

    ViewObjectImpl vo = this.getAffAgVehView1 ();

    r.setAttribute ("IdAg", Integer.parseInt (ag.toString ()) ");

    r.setAttribute ("IdAffAv", seq);

    r.setAttribute ("KmDep", km);

    r.setAttribute ("IdVeh", veh);

    r.setAttribute ("DateAff", date);

    r.setAttribute ("KmArriv", null);

    r.setAttribute ("ConsoCarb", null);

    vo.insertRow (r);

    this.getDBTransaction () .commit ();

    }

    also, I changed the default value of the EO (AffAgVeh) to adf.currentDate () and the user interface as simpleDate format: "MM/DD/YYYY.

    the problem as whene I enter 3 inputValues and click on the button I get this message:

    Timestamp format must be yyyy-mm-dd hh: mm: [.fffffffff]

    someone knows how to solve this problem

    Thank you

    Mark

    Hi Dev

    Please pass.

    java.sql.SQLException: column type invalid in the adf

    Thank you

    Subramanian M

  • How to export a user instance data and import it into another instance of a directly without storing the physical file.

    Dear all,

    I need your help I need to export data from user a (1 instance) and import it on another an instance without storage on location.

    I used to do as an export of data about the physical location and then import into another instance where I stored the dump file on physical location.

    Now I don't want to follow these method (standard method), is there any way possible means kindly share with me. Thank you very much in advance.

    Dear VA Napoleon,

    Thank you for your immediate response. If it's possible means gives the example script.

  • Prepare disks for ASM (data files and FRA)

    I intend to place data files on a disc 1 (sd1) and disk2 (PSD) when the backup of files (FRA) on disk3 (SDC). Here's how I'd do:

    For data files
    Disk1 is divided into a single primary partition (with native Linux what ID 83 not formatted system)
    Disk2 is also divided into a single primary partition (with native Linux ID 83 system not formatted)

    oracleasm createdisk vol1/dev/sda1
    oracleasm createdisk vol2/dev/sdb1

    CREATE DISKGROUP DATA EXTERNAL vol1, vol2 REDUNDANCY;


    For backup FRA

    Disk3 is partitioned into four primary partitions: / Boot (ext3), / (ext3), swap (swap) and /u01 (ext3)

    The FRA will be put under the/U01 and then attend the ASM:

    oracleasm vol3/dev/sdc4 createdisk
    CREATE DISKGROUP DATA EXTERNAL vol3 REDUNDANCY;

    Now, the problem. (1) the/U01 has already be formatted in ext3; (2) Oracle (DBMS) software will also be place under/U01

    It will be a problem?


    Otherwise, I can put FRA on the same drive as the data files, i.e. on disk1 and disk2. In this case, I need to partition the disk 1 in two primary parititions sda1 and sda2 (native Linux system ID 83 not formatted), one for data files and another for FRA (do the same for disk2). The downside is that the data file and the file recovery will be on the same hard drive.


    Please offer some suggestions.


    Thank you

    Scott

    PS: in the environment of production, all the disc 1, 2 and 3 will be on hardware RAID 1.

    RAID 1 will protect you only a device failure. It won't protect you partition, the file damage system or user errors; It will be in the image of the errors and problems like any other data.

    So what happens if you delete by mistake / U01 or some other accident happens and you loose that partition? With your current setup, you will lose everything and will not be able to restore or recover the database. Put tablespaces FRA and DB on the same physical device is certainly a very bad idea, whether or not it is a RAID.

    ASM is not a software RAID 1 mirror. It ensures redundancy of data based on file extensions and knows about files of Oracle database, which is a very good thing. You probably do not want to specify 'external redundancy.

    In a production system, you'll certainly want to mux the critical data and to store the DB controlfiles, redo logs and finally archivelogs on media separate physically in order to avoid the single point of failures wherever possible. You can use partitions and volumes in ASM, but they should be separate physical drives, otherwise you will bypass the ASM data redundancy. You must also have a solid strategy for RMAN backup. The FRA is supposed to store backupsets RMAN, copies of the image, the important archivelogs and multiplexes of the copies of the database files and should therefore always on a separate physical disk.

    Unless you simply play, I strongly suggest that review you your current configuration.

    Published by: Dude on June 29, 2012 04:55

  • How to insert the date column for the new line of adf BC tester.

    Hello

    JDeveloper version 11.1.1.5.0

    I have a table with a DATE column. I'm trying to insert a new row in the table of the BC ADF tester. While providing a value for the DATE column, I am struck the below error:

    (oracle.jbo.domain.DataCreationException) Houston-25009: failed to create an object of type: oracle.jbo.domain.Date type: java.lang.String with value: 2011/12/06

    Please let me know what should be the format to specify the date when inserting input value using the tester of BC.

    Thank you
    Rouhaud

    Roudier,
    You can determine the format of date by yourself.
    in your entity object select the attribute, click on edit, go to the control indicators, the Format type, select Date Simple
    and in the format field, you can enter the format you need
    as YYYY/MM/DD

  • turn data into columns

    Hello

    I would like to turn rows into columns and need your help

    I have

    Control Panel

    where we have two columns
    OrderID, orderdate
    orderid     order_date
    1234     9/10/2009
    4555     10/1/2009
    I have order_codes
    have 3 columns
    OrderID
    / / DESC
    value

    data to order _codes
    orderid     desc     value
    1234     ch_code1     5789
    1234     ch_date     10/20/2009
    1234     ch_miscval     678.9
    1234     ch_charge     765
              
    4555     ch_code1     9999
    4555     ch_date     10/0/2009
    4555     ch_miscval     78.9
    now

    I need to transform the data like this
    orderid ==     ch_code1      ==ch_date ==     ch_miscval ==     ch_charge ==     order_date
    1234 ==     5789 ==     10/20/200  ==    678.9 ==     765      == 9/10/2009
    4555 ==     9999 ==     10/1/2009      == 78.9 ==     ---      == 10/1/2009
    any help is appreciated

    Thank you

    Published by: vg November 2, 2010 09:47

    Try this. Hope this helps

    /* Formatted on 2010/11/02 13:29 (Formatter Plus v4.8.8) */
    WITH order_desc AS
         (SELECT 1234 orderid, 'ch_code1' descp, '5789' VALUE
            FROM DUAL
          UNION ALL
          SELECT 1234, 'ch_date', '10/20/2009'
            FROM DUAL
          UNION ALL
          SELECT 1234, 'ch_miscval', '678.9'
            FROM DUAL
          UNION ALL
          SELECT 1234, 'ch_charge', '765'
            FROM DUAL
          UNION ALL
          SELECT 4555, 'ch_code1', '9999'
            FROM DUAL
          UNION ALL
          SELECT 4555, 'ch_date', '10/0/2009'
            FROM DUAL
          UNION ALL
          SELECT 4555, 'ch_miscval', '78.9'
            FROM DUAL),
         order_t AS
         (SELECT 1234 orderid, SYSDATE order_date
            FROM DUAL
          UNION ALL
          SELECT 4555, SYSDATE
            FROM DUAL)
    SELECT   a.orderid, MAX (DECODE (descp, 'ch_code1', VALUE, NULL)) ch_code1,
             MAX (DECODE (descp, 'ch_date', VALUE, NULL)) ch_date,
             MAX (DECODE (descp, 'ch_miscval', VALUE, NULL)) ch_miscval,
             MAX (DECODE (descp, 'ch_charge', VALUE, NULL)) ch_charge,
             MAX (DECODE (descp, 'order_date', VALUE, NULL)) order_date
        FROM order_desc a, order_t b
       WHERE a.orderid = b.orderid
    GROUP BY a.orderid
    
    Output 
    
       ORDERID CH_CODE1   CH_DATE    CH_MISCVAL CH_CHARGE  ORDER_DATE
    ---------- ---------- ---------- ---------- ---------- ----------
          1234 5789       10/20/2009 678.9      765
          4555 9999       10/0/2009  78.9                            
    

    Published by: new learning on November 2, 2010 10:30

  • Format the columns for data to Excel

    Hello, everyone.

    I'm working on a document that runs a query, fills a < table > with data, then spits out an Excel sheet for the user to open or save. I use the equivalent CFSCRIPT of CFCONTENT and CFHEADER to create the Excel file.

    Code:
      <cfscript>
        pc = getpagecontext().getresponse();
        pc.getresponse().setcontenttype('application/vnd-ms.excel');
        pc.setHeader("Content-Disposition","attachment;filename=ThisData_#DateFormat(now(),'yyyy-mm-dd')#.xls");
      </cfscript>

    Everything works very well, with one exception.

    The columns of the query that is returned is a varchar data type (10) - data is a value of "month year" as "May 2010" or "June 2011".» If you look at the data in a browser, it appears in this format ("month year"). But when the Excel file is created, it appears under the name 'May 12' or 'Dec-12 "(regardless of the month, the date is always 12).

    I'm sure it's because in Excel, the column is formatted as "Général" when I need her to be 'text '. Is there a way to tell CF that needs a particular column in Excel to fit a particular way?

    Thank you

    ^_^

    This can help some:

    http://support.Microsoft.com/kb/260239

    Basically, if you are not using a solution of 'good' and exit

    HTML, give advice to Excel on how to display things.

  • The views using materialized for data warehousing and reporting

    Hello

    I would better understand the materialized views in Oracle in particular the use of the option: REFRESH QUICKLY ON COMMIT. The oracle database, we care is a PLM application and any of the tables to apply using the primary key constraints. Instead, the application uses a separate schema to store the key values for each object/save in the database. I would use Materialized View to the creation of a data warehouse smart to transfer only the lines that have updated since the last refresh of the warehouse. My understanding of the materialized views you can't define a until and unless you have a primary key constraint. It's fine and understandable.

    Can we have an oracle separate sid something like WSHD - data warehouse and using the database between the main site links - site WSHD always transfer lines that have changed since the last refresh with REFRESH QUICKLY ON COMMIT option? (Note: this is taking into account the fact that a database primary key constraints defined on the paintings of masters.)

    I guess you have to install MV NEWSPAPER tables on the main table and then create a materialized using option QUICKLY ON COMMIT REFRESH view?

    Am I wrong?

    Will there be another option for the transfer of the lines of main tables in the data warehouse in Oracle?

    Thank you very much.

    See you soon.
    Rohan

    Published by: José on 10/01/2009 00:21

    1. you can't define a materialized as ON COMMIT REFRESH in a separate database view. It must be in the database even if it's to refresh commit it.
    See http://hemantoracledba.blogspot.com/2008/06/mvs-with-refresh-on-commit-cannot-be.html

    2. you don't have to have a primary key to set a MV. You can set a MV WITH ROWID (except if you re-create the source table, you need to do a refresh of the MV because ROWID changes).
    See http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_6002.htm#i2063793

    Hemant K Collette

Maybe you are looking for