Simple @Explode Problem

The following code should output “Goal1”.

Goals:=“Goal1##10~Goal2##09”;

exploded:=@Explode(Goals;“~”;1);

@Left(exploded;“##”);

This works in a “Computed Text”, but not in a Computed Field ?

In Computed Text it shows --“Goal1” which is correct.

But in the Computed Field – “Goal1 Goal2” which is wrong.

Any thoughts ?

Raj

Subject: Simple @Explode Problem

The results you get in the computed field are correct.

@Explode returns you a list so “@Explode(Goals;”~“;1)” will return you ‘Goal1##10’ : ‘Goal2##09’.

What you want to do then is get the first element so your next line would be:

@Left(@Subset(exploded; 1);“##”);

Alex

Subject: Simple @Explode Problem

The results you get in the computed field are correct.

@Explode returns you a list so “@Explode(Goals;”~“;1)” will return you ‘Goal1##10’ : ‘Goal2##09’.

What you want to do then is get the first element so your next line would be:

@Left(@Subset(exploded; 1);“##”);

Alex

Subject: RE: Simple @Explode Problem

It worked Alex. Thanks.

I thought @Explode(Goals;“~”;1) will return the first part of the list. It even worked in Computed Text. I dont know why it didnt work in the field. Adding the @Subset has solved my problem. Thanks for yr time.

Raj

Subject: RE: Simple @Explode Problem

The reason your original formula worked in Computed Text is that Computed Text doesn’t handle lists - it just cuts off elements so you only see the first part of the list.

The third argument to the @Explode function is a boolean to specify whether or not to include empty elements.

By specifying 1 as the third argument, you’re telling Notes: break Goals into a list, then if there any empty elements in the list, leave them in place.

If you had specified 0 as the third argument, Notes would automatically trim out any empty elements.

However, the list produced by your code doesn’t have any empty elements, so it actually makes no difference what you use as the third argument.

If you only want the first element, then you need to use @Subset.

Subject: Makes sense. Thanks Scott .