Jump to content

This topic is 6249 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I have a ¶ delimited list of numbers in a field.

I need the outcome to be:

first value - second value

second value - third value

third value - fourth value

etc.

Example :)

List is

900

200

600

500

Outcome:

900 - 200

200 - 600

600 - 500

I managed to have the first and the second, and then I'm stuck.

Any hint ?

TIA

Posted

Two questions:

1. What is the purpose of this manipulation?

2. Is the number of given values constant, and if not, how many values will there be at most?

Posted

This is a recursive calculation, so a custom function would be in order. However, since it's for display only, you could use a repeating calculation field instead (result is Text ) =


Let ( [

v = Extend ( YourField ) ;  

i = Get ( CalculationRepetitionNumber ) 

] ; 

Case ( 

i < ValueCount ( v ) ;

GetValue ( v ; i ) & " - " & GetValue ( v ; i + 1 )

)

)

Posted

Thanks Comment.

Or I do something wrong, or I don't know how to implement this but I get as result only the two first values.

And probably I don't know how to use a repeating calculation....

Posted

When defining the calculation field, specify the number of repetitions as 25 (or more). Back in Layout mode, double-click the field and specify "Show repetitions:" 1 through 25 (or more).

Posted

I am more than sure that Michael could write a more refined Recursive CF but here is one.

Function Name: Hyphenate ( Field ):)

Case ( ValueCount ( Field ) > 1; 

       GetValue ( Field ; 1 ) & " - " & GetValue ( Field ; 2 ) &  ¶  &  

       Hyphenate ( RightValues ( Field ; ValueCount ( Field ) - 1 ) )

     )

Posted (edited)

No, that's pretty much it, come to think of it*. Though I would put ValueCount (Field ) into a variable, instead of counting twice.

---

(*) That is assuming we want to return null when the input is a single value. Otherwise it gets a bit complicated.

Edited by Guest

This topic is 6249 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.