FM14ADV

I have a field that has a lot of data, including something like this:

Headlights Dusk Sensor | dusk sensing

Seating Configuration

1st Row Seating Capacity | 2

2nd Row Seating Capacity | 3

3rd Row Seating Capacity | 2

Specifications

I am trying to write a statement that would grab the 2,3,2 then add them to show 7

Any ideas on how to do that?

Thanks!!

Tom

Hey, Tom. Couple of different approaches:

1) You can write a script to loop over the rows one at a time. Then you get:

GetValue ( Substitute ( currentRow ; " | " ; "¶" ) ; 2 )

gives you the number in that row. Just keep a running count and when you run out of rows, you're done.

2) You can use a custom function to extract the last column, then use the Sum function to total them up. Something like this:

Sum ( Substitute ( cfGetColumn ( yourData ; 2 ; " | " ; "" ) ; "¶" ; "; " ))

The cfGetColumn function is listed below. HTH

Mike

/*

GetColumn function

Author

*COMMENT Visual Realisation

Format

cfGetColumn ( text ; columnNumber ; columnDelimiter )

Parameters

text - any text expression or text field

columnNumber - any numeric expression or field containing a number

columnDelimiter - any text expression or text field

result - initially empty; used for tail recursion

Data type returned

text

Description

Returns a carriage return-delimited list of values from the requested column in a tabular text array.

July 7, 2008

Modified February, 2014 to use tail recursion

Mike Mitchell, Net Caster Solutions

www.netcastersolutions.com

*/

Let ( [

row = GetValue ( text ; 1 ) ;

cell = MiddleValues ( Substitute ( row ; columnDelimiter ; ¶ ) ; columnNumber ; 1 ) ;

cell = Substitute ( cell ; ¶ ; "" ) ;

countRows = ValueCount ( text )

] ;

Case (

countRows > 0 ;

cfGetColumn ( RightValues ( text ; countRows - 1 ) ; columnNumber ; columnDelimiter ; List ( result ; cell )) ;

result

)

)