Skip to main content

using database name as data in newly appended column

hi bryan,
So I have this data sources that are generated on a monthly basis by the system and before I appended all these together, I need to differentiate them by months for analysis purposes. The problem is, the only way to identify the month this report is by their filename. In the past, I've manually added this identifier to the file one by one by appending a new column within each database and specify month of analysis in the equation editor, which I found to be tedious. So I'm now thinking of uploading all of them using the upload multiple file script and add this appending function into the script. However, I can't seem to get the equation right for the life of me. I realized this might be because the database name is at different level than the data and hence I can't call the database name in the field equation. Is there a workaround to this?

Brian Element Tue, 12/12/2017 - 06:04

Hello jszzzz and welcome to the site.

So is the equation you are having difficulty with the

Right(dbName, 6) ?

This will give you the right most 6 characters of the dbName but I see the length of your field is 150 characters which is too long if you only want 6.  

So I take it that the month is part of the filename?  Can you give me an example of the filename so I can see what function would best help you extract that information.  You can put a msgbox dbName before the equation so you can see what it looks like and maybe do a screen capture.

Brian

jszzzzz Mon, 12/18/2017 - 03:44

Hi Brian, 
Thanks for your reply. Yeah that's the equation that I'm having a problem wit. I attached here the example of the file name.
Thanks so much for your help!

Brian Element Mon, 12/18/2017 - 06:08

Hi jszzzz,

The only thing I can think about is that the dbName also contains the extension .IMD so try this equation also I just realized that you need the double quotes as you are inserting the results of your equation.

Chr(34) & Mid(dbName, Len(dbName) - 9, 6) & Chr(34)

Hopefully this will fix the problem.

Brian

 

 

laura.garner Wed, 01/06/2021 - 00:58

Thanks Brian! A few years on and these resources are still being used. This snippet was incredibly helpful to me today, thanks!!

The website encountered an unexpected error. Try again later.