INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Fill Properties From Filename/Directory  (Read 1555 times)

kdwykleingeld

  • World Citizen
  • ***
  • Posts: 118
Fill Properties From Filename/Directory
« on: May 30, 2014, 12:41:44 am »

Hi, i am trying to update some fields from my directory name and it seems that the replacement works from to back towards the front ..

I have a file structure with multiple levels of sub directories and i just want to use the upper directory in one of my fields..

c:\a\b\c\bla1.txt
c:\d\e\g\h\bla2.txt
c:\x\y\bla3.txt
c:\z\bla4.txt

i just want to set [Comment] to the highest dir name    so ..   "a" for the 1st ,  "d" for the 2nd etc

a filter such as [Comment]  always gives me the lowest level subdir     so .. "c" for the 1st ,   "h" for the 2nd ..

so.. any ideas how to do this ?

thx koen
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Fill Properties From Filename/Directory
« Reply #1 on: May 30, 2014, 12:46:41 am »

Fill Properties is template based.  You might have better luck using the expression language and assigning to a field.  Use ListItem() on the Filename field, with backslash as the separator.  Ask if you need more help.
Logged
The opinions I express represent my own folly.

kdwykleingeld

  • World Citizen
  • ***
  • Posts: 118
Re: Fill Properties From Filename/Directory
« Reply #2 on: May 30, 2014, 12:53:08 am »

hi thx,  i will have a look at that !!

however

i know its template based .. but how does the termplate allow me to wildcard out the lower level of subdirs ..

or is it always "absolute" from the lowest level and not possible this way at all ?   (with fill from filename/dir)

thx 
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Fill Properties From Filename/Directory
« Reply #3 on: May 30, 2014, 12:56:51 am »

Each item consumes as much as it can, so long as the template matches.  So you'd need enough stuff after [comment] to force the position matches.
Logged
The opinions I express represent my own folly.

kdwykleingeld

  • World Citizen
  • ***
  • Posts: 118
Re: Fill Properties From Filename/Directory
« Reply #4 on: May 30, 2014, 12:59:36 am »

ok thx.. with other words .. this does not work for my use case since i do not know how deep each directory is ..

anyways i will dig myelf into the expresssion field

thx

reg koen
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Fill Properties From Filename/Directory
« Reply #5 on: May 30, 2014, 01:05:46 am »

Consider creating a new user field, which calculates the top level directory.  That way, you never have to do it again.

   Listitem([filename], 1, \)
Logged
The opinions I express represent my own folly.

kdwykleingeld

  • World Citizen
  • ***
  • Posts: 118
Re: Fill Properties From Filename/Directory
« Reply #6 on: May 30, 2014, 01:14:12 am »

hi,  wow.. this was easy ..

fixcase(ListItem([Filename (path)],1,\),4)

did the job

thx !

reg koen
Logged

kdwykleingeld

  • World Citizen
  • ***
  • Posts: 118
Re: Fill Properties From Filename/Directory
« Reply #7 on: May 30, 2014, 01:23:13 am »

just saw your syntax which is even more simple

thx again.. i will start using this functionality extensively !!

reg koen

Logged
Pages: [1]   Go Up