Jump to content

External Data - Trim Headers


Recommended Posts

Is it possible to 'Trim' the headers of an External Data file?

 

I have multiple external data files and all have inconsistent headers. Some headers have trailing spaces while other headers do not have trailing spaces.

 

See highlighted (RED) text below where I attempted to use 'SetFieldValue' to replace the field content. But apparently this will only allow you to replace field values and not header values.

 

inFile = PrimaryInputFile()

// ----------------------------
// --------    XDF1    --------
// ----------------------------
if (inFile.search("SEG1")>-1)
   {
   xdf1 = "_SEG1_STANDARD_REV.csv";
   }

if (inFile.search("SEG2")>-1)
   {
   xdf1 = "_SEG2_MATINEE_REV.csv";
   }

if (inFile.search("SEG3")>-1)
   {
   xdf1 = "_SEG3_UPGRADE_REV.csv";
   }

if (inFile.search("SEG4")>-1)
   {
   xdf1 = "_SEG4_T1-T2_REV.csv";
   }

[color="Red"]if (xdf1 != ""){
   xdf1 = new ExternalDataFileEx(xdf1, ",")
   xdf.ignoreNumericFieldNames=true
   for (var i=0; i<xdf1.fieldCount; i++)
       {
       xdf1.SetFieldValue(0, i, Trim(xdf1.GetFieldValue(0, i)))
       }
   }

[/color]

Link to comment
Share on other sites

Thank you, Dan. I did end up doing as you suggested.

 

Because of QC checks performed by our data department it isn't 'appreciated' if we have to alter the data that is passed to me. I do alter if necessary, as in this case. However, it would be good to have a FusionPro function that would do this internally.

 

Thanks again... this forum is awesome for finding ways to get the job done!!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...