AnsweredAssumed Answered

What is wrong with my calculation?

Question asked by TechsupportLito on Dec 18, 2013
Latest reply on Dec 19, 2013 by TechsupportLito


What is wrong with my calculation?


     Quite new at using FileMaker so this may be a real beginners question but i have to get this working.


     I'm trying to calculate a file path from the files name and there are two kinds of files.

     One type of file is always named like this, 01-23456.jpg and the other one i always named abcd_123456.jpg. These images are located in two different folder structures and i need to calculate where they are.

     If i make two different calculations like this.

     If ( Left (img1;2)    ≥    0 ; settings::path_image_display & "MyFolder1/" & Left ( img1 ; 2 ) & "/" & img1  )


     If ( Left (img1;5) =  "abcd_"; settings::path_image_display & "MyFolder2/" & Left ( img1 ; 9 ) & "/" & Substitute ( img1; "_M" ; "" ))

     they do both work just as i want them to. But since i don't know in advance what type of image field img1 will be i do need to make a combination of these two calculations and this is what i have come up with so far.

     If (img1 ≠ ""; 

     Case ( If (Left (img1;2)   ≥   0  ; settings::path_image_display & "MyFolder1/" & Left ( img1 ; 2 ) & "/" & img1) ;
     If (Left (img1;5) = "abcd_" ; settings::path_image_display & "MyFolder2/" & Left ( img1 ; 9 ) & "/" & Substitute ( img1; "_M" ; "" )) ))
     As you can see i have also added a rule that this will only be calculated if the field has an value. 
     The combined calculation works just fine if an abcd_123456.jpg image is entered in img1 but when i enter 01-23456.jpg the value returned is none and i just can't figure out why.
     My calculation is set to be returned as text.

     Any help is appreciated!!