This discussion is archived
8 Replies Latest reply: Jun 19, 2013 1:35 AM by user11203834 RSS

Export .csv file

user11203834 Newbie
Currently Being Moderated

Hi All,

 

 

 

I am importing a .txt file and i wanted the export as .csv file. Can anyone help me to find the settings i need to change to get the output as .csv fie, instead of .dat file

 

 

 

Many Thanks,

JK

  • 1. Re: Export .csv file
    focusharsh Newbie
    Currently Being Moderated

    Hello user11203834

     

      kindly explain the problem in brief.

     

    What exctaly u are imporing and Exporting and from where u are exporitng and importing ( from Any applicaton or Database) ?

     

    Thanks

    HARSH SHAH

  • 2. Re: Export .csv file
    user11203834 Newbie
    Currently Being Moderated

    Hi Harsh

     

    I am using PULL adapter to get a .csv file from a .txt file after some data transformation. My FDM input file is .txt file and i need the out put a .csv file. It is basically exporting to a flat file from a flat file.

     

    Many Thanks,

    JK

  • 3. Re: Export .csv file
    SH Guru
    Currently Being Moderated

    You will need to edit the export action script in the PULL adapter. The file name is passed into this script as an imput parameter strFile so you need to manipulate this variable to replace the .dat extension with the.csv extension. You will also need to change the value addigned the the delimiter in the strDelim variable fro the default which is Tab to a comma.

  • 4. Re: Export .csv file
    user11203834 Newbie
    Currently Being Moderated

    Thank you SH.

     

    I have changed the strDelim = ","

     

    But where do i manipulate the ' strFile'. I didnt find '.dat ' anywhere in the script.  Below is the part of the full script. Is this function stored somewhere else..?

     

    strDelim = ","

      strTargYear = API.POVMgr.fPeriodKey(CStr(strPer(0))).strTargetYear

      strDataValue = API.POVMgr.fCheckLocProf(CStr(strLoc)).strDataValue

      strCatFreq = API.POVMgr.fCategoryFreq(CStr(strCat))

     

      'Open the file system object

      Set objFileSys = CreateObject("Scripting.FileSystemObject")

      Set objFile = objFileSys.CreateTextFile(strFile, RES.FDMTrue, API.DataWindow.DBTools.fGlobalOptionGet(API.IntBlockMgr.IntegrationMgr.PstrSysKey & "EnableUnicode").Status)

     

      If Err.Number > 0 Then

      objR.intResult = RES.FDMFalse

      objR.strErrDesc = Err.Description

      objR.lngErrCode = Err.Number

      'Log Action in transaction log

         API.DataWindow.DBTools.mLog 5005, API.DataWindow.Connection.PstrUserID, CDate(dteStartTime), Now(), CStr(strFile), "Err", "Export Info: Cat=" & strTCat & " Per=" & strPerDesc & " Year=" & strTargYear, CStr(objR.strErrDesc)

     

    Many Thanks,

  • 5. Re: Export .csv file
    SH Guru
    Currently Being Moderated

    You will not find .dat in the script. The file name is stored in the variable strFile. You will need to add some code like the following near the start of the script before the file is manipulated.

     

    strFile = Replace(strFile, ".dat", ".csv")

  • 6. Re: Export .csv file
    user11203834 Newbie
    Currently Being Moderated

    Hi SH,

     

    Thanks for your reply

    I have tried with your script  but no luck. Can you guide me to the place where the value is assigned to variable 'strFile', as i can directly go and change it.

    I have gone through all the object through the object browser and couldn't find something related to strFile.

     

    Many Thanks

  • 7. Re: Export .csv file
    user10757003 Journeyer
    Currently Being Moderated

    If this is holding you up, then a quick solution would be to just rename the file at the end of the adaptor export script. From memory the strFile gives the full path, but if it doesn't you can easily find code in the accelerators to give the path to the outbox where the file gets written to.    

  • 8. Re: Export .csv file
    user11203834 Newbie
    Currently Being Moderated

    Thanks SH.

     

     

    Where is accelerator. where can i find the full path ?

     

     

    Thanks for helping me out..

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points