Jump to content
Sign in to follow this  
JTSmith

Writing an export contents script for all records, but what about different extensions?

Recommended Posts

I can write a script that goes through each record and exports all the containers, but not all of my containers have the same file type. Is there a way to make it just either export the original file name, or preserve the extension?

I have 15 containers per record, and I would prefer to name them "1.original extension", "2.original extension", etc. Is that possible?

Thanks!

Share this post


Link to post
Share on other sites

Do all your container fields contain the original extension? You can check this by looking at the result of =

GetAsText ( YourContainerField )

If the answer is yes, you can parse out the original extension from there and use it in the export.

I have 15 containers per record

That doesn't sound like the best arrangement; why not keep them as separate records of a related table?

Share this post


Link to post
Share on other sites

Thanks! Yes, they have the original extension, and I will figure out how to parse after the period. I'm not an expert on parsing, but that part I should be able to figure out. Thank you for the help (again). I do have a table of Property Images, which is where they are stored.

Share this post


Link to post
Share on other sites

OK, I lied, I can't figure it out... Can you help me to parse everything after the period?

Share this post


Link to post
Share on other sites

If all your files have a three-letter extension, it could be as simple as =

Right ( FileName ; 3 )




(or 4, to include the period). Otherwise, try =




Let (

len = Length ( FileName )

;

Right ( FileName ; len - Position ( FileName ; "." ; len ;  -1 ) )

)

Share this post


Link to post
Share on other sites

Thanks, I did figure out the first option, but some extensions were JPEG, so I couldn't figure out the period. No I got it, thanks a lot.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.