Can you calculate a substring based on another column?
slimshaky
Posts: 13 Bronze 1
I'm evaluating a trial version of data generator and have a few scenarios that I'm wondering if the product can handle. One scenario is populating a column of file extensions based on a full filename in another column. I don't have any python knowledge, but I'm guessing that you should at least be able to address this with a python script? For example, the filename could be image.jpg and the file extension would be jpg.
Tagged:
Answers
Hi @slimshaky!
Yes, I believe that should be possible and the post here may help: https://stackoverflow.com/questions/6169324/partition-string-in-python-and-get-value-of-last-segment-after-colon
You can split the filename using '.' as the delimiter and then return the last element of the split string. It may include something like:
return mystring.split('.')[-1].
Hope that helps!
Jessica Ramos | Product Support Engineer | Redgate Software
Have you visited our Help Center?