7 Replies Latest reply on Aug 22, 2016 10:48 AM by lindseym

# Nested Calculations

Hello,

I have a current calculation that works great. This issue is I became aware of a situation that now needs to be factored in.

Currently here is what happens.

I want the leading 000 to be removed from the copy (side a) if they are present.

I think a "getasnumber" parameter would work, but I am a little confused how / where to add it.  So it only evaluates for leading zeros if Copy (Side A) = LOC # and Location Calculation has leading zeros. There are times there will be 2 leading zeros or maybe 5, definitely not consistent.

Here is my current Case calculation:

-------------------

Case (

\${Copy (Side A)} = "LOC #" ;

Substitute ( LeftWords ( Location Calculation ; 1 ) ; "TBD" ; TextStyleAdd ( "TBD" ; HighlightYellow ) );

Substitute (

\${Copy (Side A)} ;

["TBD" ; TextStyleAdd ( "TBD" ; HighlightYellow )];

["LOC #" ; LeftWords ( Location Calculation ; 1 )]

)

)

--------------------

Thank you.

• ###### 1. Re: Nested Calculations

Is there any value other than "TBD" it should be treated as text?

And they should be left aligned in same field?

I couldn't get how the 2nd value become 123, it looks applied 1st case in the calculation...

If there is value like "123-4" in Location Calculation, it is one word.

• ###### 2. Re: Nested Calculations

I have a calculation set to see "123-A" where the dash is considered a space, and I only want the 123.

My main focus is how to get rid of the leading Zeros in column copy side A

----------

If /Copy (Side A) = LOC  #

Get 1 left word from location calculation

If 1 left word from location calculation contains leading zeros, remove leading zeros.

-----------

Thank you.

• ###### 3. Re: Nested Calculations

Attached is the FMP file and the data cvs to see the true calculations.

• ###### 4. Re: Nested Calculations

This would work on some cases.

Let ( n = text + 0 ; Case ( n = 0 ; text ; n ) )

• ###### 5. Re: Nested Calculations

Where would I place that in this calculation? That's the other issue I am having.

----------------------

Case (

\${Copy (Side A)} = "LOC #" ;

Substitute ( LeftWords ( Location Calculation ; 1 ) ;

"TBD" ; TextStyleAdd ( "TBD" ; HighlightYellow ) );

Substitute (

\${Copy (Side A)} ;

["TBD" ; TextStyleAdd ( "TBD" ; HighlightYellow )];

["LOC #" ; LeftWords ( Location Calculation ; 1 )]

)

)

---------------------------

• ###### 6. Re: Nested Calculations

I'm not sure how to change the current calculation, since your example provides only first case of

\${Copy (Side A)} = "LOC #"

Let ( [

text = LeftWords ( Location Calculation ; 1 ) ;

n = text + 0 ;

text = Case ( n = 0 ; text ; n )

] ;

Case (

\${Copy (Side A)} = "LOC #" ;

Substitute ( text ;

"TBD" ; TextStyleAdd ( "TBD" ; HighlightYellow ) );

Substitute (

\${Copy (Side A)} ;

["TBD" ; TextStyleAdd ( "TBD" ; HighlightYellow )];

["LOC #" ; text ]

)

)

)

1 of 1 people found this helpful
• ###### 7. Re: Nested Calculations

Thanks!

I pasted this in and it worked perfectly.