3 Replies Latest reply on Dec 6, 2015 1:40 PM by keywords

    GetContainerAttribute(sourceField;attributeName) not returning data

    peteraddison

      I want to extract the name of a file used in a container. The function:

       

      GetContainerAttribute(sourceField;attributeName)

       

      should handle this.

       

      However, when I've added this to the calculation, I get "?" (question mark) instead of data.

       

      I can drop in a new file and it returns the data. In fact, if I export the file, then drop it back in, it displays correctly.

       

      So: I know my formula is correct and functioning, but it's not looking back at previously inserted files.

       

      I also have a formula that converts to text and it has the information that I need, but it also has a lot I don't need. It's working fine.

       

      I could export all files and re-place them, but there are some 12,000 records in the file, so that's not very practical.

       

      Anyone know how I can force the "get" function to display the data?

        • 1. Re: GetContainerAttribute(sourceField;attributeName) not returning data
          coherentkris

          As soon as you set the calculation definition and save it it will execute and produce the results of your calculation. If you have GetContainerAttribute ( your_container_field ; "filename" ) it will return the filename of whatever file you have in the container. When you change the contents of the container the calc will fire.

          Option 1: change the calc and save it.

          Option 2: replace field contents on the container with itself

          Option 3: create a trigger field and change the calc to

          Let (

          _trigger = the_trigger_field ;

           

          GetContainerAttribute ( your_container_field ; "filename" )

          )


          With option 3 everytime you tweak (set it to anything) the trigger field the calc will refire.


          If its returning ? then make sure the display field is wide enough to show the complete results.

          • 2. Re: GetContainerAttribute(sourceField;attributeName) not returning data
            peteraddison

            Thanks Kris,

             

            Option 1 did not work, every time I changed the calculation ALL the question marks came back, even the ones that previously had names. I expected it to work this way, but it doesn't for some reason.

             

            Option 2 works, but with 12,000 records I wrote a routine to do the replacement for me.

             

            If I change the attributes I want to see I have to run the replacement routine again due to what happens in option 1. For instance i wanted to see the filename of the file that's in the folder, not the name of the file that was originally placed. I had to change the attribute to GetContainerAttribute([containerfield];"externalFiles"). The reason for that is that if you paste in a file that happens to have the same name as another file, FM Pro will append a serial number to the end of the filename to avoid over-writing. (I had a lot of "untitled" images pasted in!) I'm keeping that script handy just in case.

             

            For assistance, here's the script:

            Screen Shot 2015-12-06 at 1.23.52 PM.png

             

            Option 3, I have not tested. However it sounds like the best thing to do and avoids the risky and manual-step of running the  replace script I wrote. If it comes back to haunt me I'll test it.

            • 3. Re: GetContainerAttribute(sourceField;attributeName) not returning data
              keywords

              Re: "If its returning ? then make sure the display field is wide enough to show the complete results"

              A quick way to check whether this is the issue is to click inside the field with the ? showing. If the problem is merely a display thing, then the actual field contents will be revealed.

              If that is the problem, then making the field bigger is the obvious solution, but it is also worth checking the amount of padding in the field too; sometimes reducing that is sufficient.