3 Replies Latest reply on Jun 6, 2012 11:58 AM by philmodjunk

    Return a field's value in the Case function

    alexjeane

      Title

      Return a field's value in the Case function

      Post

      Friends,

       

      I'm trying to return a field's value in addition to some text in the execution of a successful Case function.

      We have it set up like this so far:

       

      Case ( 
      
      Abs ( Get ( SystemPlatform ) ) = 1 ; "filemac:" & Get ( DesktopPath )  &"tds.pdf" ;
      Abs ( Get ( SystemPlatform ) ) = 2 ; "filewin:" & Get ( DesktopPath )  &"tds.pdf" 
      
      )
       
       
      I know you can add in multiple sets of strings in the result such as & "good" & "tds.pdf" in the end, but I'm having trouble successfully 
      passing through anything that is interpreted by an inputted value in the database.
       
      The best I got was
       
      Case ( 
      
      Abs ( Get ( SystemPlatform ) ) = 1 ; "filemac:" & Get ( DesktopPath ) & GetField ( fieldName )  &"tds.pdf" ;
      Abs ( Get ( SystemPlatform ) ) = 2 ; "filewin:" & Get ( DesktopPath ) & GetField ( fieldName ) &"tds.pdf" 
      
      )
       
      When I select the right field, the resultant output is a ?tds.pdf.  I'd like it to read the value inside that record's field and 
      add it onto the front end of "tds.pdf" such as "baseballtds.pdf" if the field's value was "baseball."
       
       
      If you have any ideas of where to go, I'd really appreciate it.  I feel I'm close.
       
      Thank you!

        • 1. Re: Return a field's value in the Case function
          philmodjunk

          You should be able to use:

          Get ( DesktopPath ) & tableOccurrenceName::fieldName &"tds.pdf"

          Note: in most cases, you can use: "file:" & Get ( DesktopPath ) & tableOccurrenceName::fieldName & "tds.pdf"

          instead of the platform specific filemac and filewin tags to avoid the need to test for a specific plattorm.

          If the above syntax does not work, you'll need to describe teh context in which you are using this calculation. In a calculation field? In a set variable script step?

          If in a script step, the current record and current layout's specified table occurrence can affect what value if any is returned by the field reference.

          • 2. Re: Return a field's value in the Case function
            alexjeane

            Phil,

             

            It was just as simple as you mentioned. No special function call, just the table and field.  I also took out the system tests and it's working like a charm.  

             

            Thanks for the swift reply!

            • 3. Re: Return a field's value in the Case function
              philmodjunk

              BTW, the simplest way to add a correctly entered reference to a tableoccurrence::field in a calculation is to put your cursor where you want it to appear in the specify calculation dialog and then double click the desired field in the list of fields shown above your expression. There's a drop down there where you can first select a table occurrence and then select a field defined in that occurrence's data source table.