Javascript to show file path

37 views
Skip to first unread message

Robert Kantor

unread,
Nov 27, 2018, 9:08:31 AM11/27/18
to mementodatabase
I am trying to add a JavaScript Field type names File Path that will show the file path of the File Name field type File.

I added the following to my script 

if (field('field4') == "") 0; else field('File Name').existingPath ;

Although I am getting an undefined in the File Path at run time.

Any advice and/or guidance?

Thank you,
  Robb

Bill Crews

unread,
Nov 27, 2018, 11:35:49 AM11/27/18
to Robert Kantor, mementodatabase
The field() method returns, for a File field type, an array of pathnames, one for each of the files. It does not return an object, so I don't know where you got the object property name of existingPath, but it's not needed.

Just refer to field("File Name")[0], field("File Name")[1], and so on until you get beyond field("File Name").length.
Reply all
Reply to author
Forward
0 new messages