Jump to content
Sign in to follow this  

Container Field label Lookup

Recommended Posts

beckham    0


Can anyone please advise on my following issue.

I have a FM12 file with Container Fields that contain small jpegs, I want to have a text field that shows the title of the image inserted BUT without the .jpg at the end?


To explain, If i drag an image named "picture1" and place it in a <<container_name>>

the result is <<picture1.jpg>> how do i prevent the .jpg displaying? I just want <<picture1>>


Many thanks

Share this post

Link to post
Share on other sites
Matthew F    39

Undoubtedly there's a more elegant way, but this would probably do it:


Substitute( Substitute ( container_name ; ".jpg" ; "" ) ; ".JPG" ; "")

Share this post

Link to post
Share on other sites
beckham    0

Thanks for the reply Matthew but i can't get that to work?

To display the name i am simply creating a text field <<containername e.g. A1>> resulting in <<picture123.jpg>>

I want it to be <<picture123>>


Thanks again

Share this post

Link to post
Share on other sites
Matthew F    39

OK.  I'm not sure that the '<<' and '>>' means in your question.  I'm assuming that your are not talking about merge fields which use those kinds of brackets to insert variables in a line of text on a layout.  Correct me if I'm wrong.


Substitute( Substitute ( container_name ; ".jpg" ; "" ) ; ".JPG" ; "")


The calculation above can be used in several different ways to get you the output you want.  One way would be to use it in the definition of a new calculated field that strips the '.jpg' off of the contents of container_name.  You could also use it in a script that strips the .'jpg' off of your text field and replaces it with the new value.  This script could be initiated by the user with  a button on your layout or, more automatically, by attaching it to a script trigger ('On Save') on the container_name field.   


The way you implement it will depend on how you would like your solution to behave.  Am I making sense?  


P.S.  When you specify the calculation to a script or to a field definition, I'd suggest using the built-in tools for picking field names and commands.  That way you won't forget to add in the table name for related fields  (e.g. Related Table::container_name).  Also you will make fewer syntax mistakes in the commands themselves (or inherit my mistakes). 

Share this post

Link to post
Share on other sites

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

Sign in to follow this  

  • Similar Content

    • By wedgeman
      So i'm dealing with two tables.
      1.  VisitTable.
      2. GraphicsTable
      in a VisitTable layout, i have one or two portals related to the GraphicsTable, each related by a different factor.  One portal would be related by a Date field, the other would be a ClientName field..
      My desire is to click on a thumbnail in either one of these portals, and have that selected image be displayed in a separate/larger image window (which could be a container field in the current table, Or another portal?  I don't care how - i just need to have it show up) 
      I don't know the best method for doing this (ie., click thumbnail to have image fillin a separate location).  In this particular instance, I don't want this to be a separate window, but to display in a container field view on the current window/layout. 
      how do I accomplish this?

    • By Bill_misc_IT
      I have a solution to track employee expense reports which contains a container to store a pdf of related receipts.  Currently, I create a multiple page pdf of receipts in Apple Preview, then paste it into the container.  Was wondering if it was possible to create a FM script or AppleScript to drop a single, additional pdf into the container and "automatically" create multiple page pdf with the existing container contents?
      Thanks in advance!
    • By sal88
      Hi all
      Fairly trivial (but annoying) problem here!
      I've just transferred all Invoice PDFs to their respective container fields - which is externally stored (non secure) on the FMS Server.
      However the first PDF in the table had an '_1' at the end of the filename on the server. When I cleared the field and re-added the PDF it then has '_2' at the end, and so on.
      The underscore disappeared when I transferred the container from 'Invoices/' to 'Invoices2/' but the problem remains when I transfer back to 'Invoices/'.
      It doesn't happen to any other PDFs/records, just this first one in the table. Any ideas how I can 'reset' this?
    • By jbante
      I'm working on a function to extract text from a .txt.gz file in a container field:
      //SM_TextFromGZIP ( containerFieldName ) import java.util.zip.GZIPInputStream; import java.util.io.*; GZIPInputStream gunzip = new GZIPInputStream(fmpro.getContainerStream(containerFieldName)); InputStreamReader reader = new InputStreamReader(gunzip); BufferedReader pr = new BufferedReader(reader); String line; String finalOutput = \"\"; while ((line = pr.readLine()) != null)     finalOutput += line; return finalOutput; When I run this, I get this from the SMLastStackTrace function:
      java.io.IOException: com.prosc.fmkit.types.FMBinary$FMContainerInputStream.read() returned value out of range -1..255: -117     at java.util.zip.GZIPInputStream.readUByte(GZIPInputStream.java:250)     at java.util.zip.GZIPInputStream.readUShort(GZIPInputStream.java:237)     at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:140)     at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:56)     at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:65)     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)     ... Any thoughts on a fix or alternative solution?
    • By naio
      My old fp7 solution had some fields that store the path to external pdf files, the files were stored in the same server machine and the path were like "file://oldserver/folder/file", the pdf files are shown in the solution through a webviewer field. The solution is developed under the 'separation model'.
      I just converted the solution to FM15 and I moved into a new server, at present I have both servers up and running, so the fmp12 database with fields pointing to "file://oldserver/folder/file" still shows pdf files as expected.
      Given that I want the paths to point to a certain folder into the new server I'm trying to find the right path to the new location of files but so far I haven't been able even thought I made sure that users fmserver and fmsadmin have full permissions on the folder that stores the pdf files.
      On the other hand I've seen that FMS15 creates a folder named "RC_Data_FMS" with a subfolder for each fmp12 file where the external container data is meant to be stored. Am I forced to store my pdf files in there OR somewhere else in the network?
      Thank you in advance.

Important Information

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