Jump to content

This topic is 5843 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi all,

Does anyone know how I can get the name of the file stored in a container, without using a hard-coded field name?

This was my idea (below), but it only returns a "?"

Evaluate(

GetAsText(

Left(Get (LayoutTableName); 3) & " • File1"

)

)

The table I'm working in is named T2B • Artworks, the container field object name is T2B • File1

Any ideas?

I'm trying to have a layout independent script to import/export container field content, which I can use on any layout in any table simply by adjusting the object names of the container fields.

Any help much appreciated!!

Posted

Try something like:

GetAsText ( GetField ( Get ( LayoutTableName ) & "::" & "FieldName" ) )

or just:

GetAsText ( GetField ( "FieldName" ) )

Posted

Right... but then it's tied to the field name. Granted, I could name all fields in all tables which store files of any kind the same way - but it would be much more flexible if I could get the information through the object name of the field. That way I could name the field freely according to their purpose.

Impossible?

Posted

I think you just changed the way I program forever... I was totally unaware of the source attribute for the GetLayoutObjectAttribute function. That is super useful!

Thank you!

I even used $ObjectName for "Object Name" which was previously retrieved as Left(Get (LayoutTableName); 3) & " • File1" - and which makes it entirely portable in my view.

All I have to do now on any given layout is give the media field(s) a name based on the convention above, and I can upload, export, email and delete a media file of any kind and format. Time required? A couple of seconds.

Fantastic :(-)

Posted

I don't quite see what role LayoutTableName would play here. You could simply name your object "Container" on every layout, and the formula:

GetAsText ( GetField ( GetLayoutObjectAttribute ( "Container" ; "source" ) ) )

will automatically return the filename of the file stored in the current layout's object.

Posted

Good point. It can be simplified like you suggest.

If I was putting the information in a global variable for some kind of use, I would need something that identifies what layout a certain "container" is located on. But since this is not the case - you're absolutely right.

This topic is 5843 days old. Please don't post here. Open a new topic instead.

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
×
×
  • Create New...

Important Information

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