Leading zero truncated by importcell(


#1

I have two files with a text field set up the same. File A’s field has alphanumeric data, sometimes contains letters, always containing numbers.

When I import the data from File A into File B using:

importtext fileload(lvFolder),“ExistingData”,“Replace”,“Rearrange”,importcell(0)+¬+…

If the data in File A leads with a zero and has no letters, the leading zero is removed. If the data contains a letter and has a leading zero, the zero is saved.

ie: 028130 imports as 28130
02290P imports as 02290P

I’ve been using this procedure for a year now, and this is the first I’ve noticed this happening. Is this expected behavior and is there a workaround?


#2

I’m pretty sure there is more to this story that you aren’t telling us. You say you are importing data from File A into File B, but the code you have given us imports from a text file, not another database. How is the data getting into that text file? If you look at it, I’ll bet you’ll see that there are no leading zeros in the text file. In that case, the question is what is your export doing to remove the leading zeros? But you haven’t shown us the export code.

By the way, if you are transferring directly from one database to another, you don’t need a text file, you can just use a variable that you create with arraybuild (unless you need the text file for somewhere else).

I would also suggest that if you are transferring data from one database to another, it is probably easier to arrange the export data to match the second database, rather than doing the rearrangement on the import side. Though of course it can be done either way.


#3

Thanks for the reply, I didn’t noticed it had been answered. The problem, of course, hasn’t reoccured, so I will have to take time to dig up the old data, etc.

In answer to the questions, the data is a weekly .csv deposit statement from our credit card provider. It is imported into a file that is then used to compare the info from the database containing our daily credit card transactions and make sure the money was properly deposited and credited. The identifying transaction code was the one with the missing zeros.

As I don’t need all the info in the deposit .csv, it is just easier to import using

importtext fileload(lvFolder),“ExistingData”,“Replace”,“Rearrange”,importcell(0)…

There is no manipulation of the cell in question by the importcell(

Checking the original .csv source and the master transaction file against the import target file, there were missing leading zeros.

I’ll keep looking for what went wrong the other week.