7 Replies Latest reply on Jan 20, 2015 8:31 AM by AndrewJudd

    Tricky calculation field

    AndrewJudd

      Title

      Tricky calculation field

      Post

      Hi all, I have a calculation field that acts as an artwork preview for a product. There by listing all the necessary parts. I'll copy the calculation below. The issue I have is when an artwork is a video or doesn't have strict 3d dimensions as such, the dimensions fields are empty. I need therefore to drop the text part of "cm" when this is the case.

      Any ideas? Thank you.

       

      ARTWORK::Artist &¶ &TextStyleAdd(ARTWORK::Title;Italic) &¶ & ARTWORK::Date &¶ &ARTWORK::Medium &¶ & ARTWORK::Heightcm  & " "  & "x" & " " &   ARTWORK::Widthcm &  If (not IsEmpty ( ARTWORK::Depthcm ) ; " x "
       & ARTWORK::Depthcm & " " & "cm" ) & If (IsEmpty (ARTWORK::Depthcm) ; " cm") &  ¶ & ARTWORK::Edition Number & If(IsEmpty (ARTWORK::Edition Number) ; ARTWORK::Inventory #)  & If(not IsEmpty (ARTWORK::Edition Number) ;  ¶ &ARTWORK::Inventory #) & ¶ & ¶ & ¶

       

        • 1. Re: Tricky calculation field
          AndrewJudd

          I am now using this but it's not quite solved the issue.

          List (Artist)  & ¶ & TextStyleAdd (Title;Italic) & ¶ & (Date) & ¶ & (Medium) & If(IsEmpty (Heightcm) ; ¶) & If(not IsEmpty (Heightcm) ; ¶)  & (Heightcm) & If (not IsEmpty (Heightcm) ; " x ") & (Widthcm) & If (IsEmpty (Depthcm) ; " cm")  & " " &  (Depthcm)  & If (not IsEmpty (Depthcm) ; " cm")  & ¶ & (Edition Number) & ¶ & (Inventory #) & ¶ & ¶

          • 2. Re: Tricky calculation field
            philmodjunk

            In this context, List (Artist) will not change your results. It's the same as using Artist by itself in this calculation.

            Try it this way:

            List ( ARTWORK::Artist ;
                     TextStyleAdd(ARTWORK::Title;Italic) ;
                     ARTWORK::Date ;
                     ARTWORK::Medium ;
                     If ( IsEmpty ( ARTWORK::Heightcm ) ; ARTWORK::Heightcm & " "  & "x" & " " &   ARTWORK::Widthcm &  If (not IsEmpty ( ARTWORK::Depthcm ) ; " x " & ARTWORK::Depthcm & " " )& "cm" ) ;
                    If(IsEmpty (ARTWORK::Edition Number) ; ARTWORK::Inventory # ; ARTWORK::Edition Number ) 
            ) & ¶ & ¶ & ¶

            Note: This exploits the List() feature that leaves out the delimiting return when the list member is Null (empty).

            • 3. Re: Tricky calculation field
              AndrewJudd

              Thanks, unfortunately with that script a few things happen -

              1. when height, width and depth are all empty you still have a line between medium and inventory number that says "x cm"

              2. when you enter dimensions the sizes part of the calculation dissapears (as attached)

              • 4. Re: Tricky calculation field
                philmodjunk

                List ( ARTWORK::Artist ;
                         TextStyleAdd(ARTWORK::Title;Italic) ;
                         ARTWORK::Date ;
                         ARTWORK::Medium ;
                         If ( NOT IsEmpty ( ARTWORK::Heightcm ) ; ARTWORK::Heightcm & " "  & "x" & " " &   ARTWORK::Widthcm &  If (not IsEmpty ( ARTWORK::Depthcm ) ; " x " & ARTWORK::Depthcm & " " )& "cm" ) ;
                        If(IsEmpty (ARTWORK::Edition Number) ; ARTWORK::Inventory # ; ARTWORK::Edition Number ) 
                ) & ¶ & ¶ & ¶

                • 5. Re: Tricky calculation field
                  AndrewJudd

                  THANK YOU

                  • 6. Re: Tricky calculation field
                    AndrewJudd

                    Hi Phil, I just noticed. The above calculation seems to drop (remove) the inventory # when you have an edition number in there. Could you take a look?

                    thanks so much.

                    • 7. Re: Tricky calculation field
                      AndrewJudd

                      **Ignore, sorted  it. thanks.