Hello,
I am trying to use @Explode in a computed field in XPage, but not able to do that.
In that computed field I used @Explode([07/02/96 - 07/05/96]) and it returns 0.021875000000000006, but it should return 07/02/1996; 07/03/1996; 07/04/1996; 07/05/1996.
Any help in the right direction will be appreciated or any other way to find this result.
Thanks and regards
Sandip
Subject: @Explode Date range doesn’t work
I have solved this with a bit of javascript seehttp://NotesNinjas.com/#ExplodeDatesXpages
Subject: @Explode
From looking at the help, I think @Explode in XPages can only be used to split a string.
I think the “07/02/96 - 07/05/96” is being calculated. I get the number you’re seeing if I do the calculation ((07/02)-(07/05))/96
Subject: @Explode
Yes.
Thanks for that, but how to get my required result.
Sandip
Subject: Try using session
I don’t have any code in front of me. But there are 2 types of @functions. The new Xpage ones and the original @Formula ones.
I ran into this before when trying to use @Unique to generate a unique number in the traditional form of “DLEY-86HRUM”. The new XPages @Unique gave me a weird long decimal number.
I had to use something like session.eval(@Unique) I think… It might be on my blog somewhere at lotusnotebook.com.
So it’s possible that you could do session.eval(@Explode…) and get the behaviour that you expect.
Just a thought.
Subject: Try converting them to a string and then back again
As far as I know, Xpages only supports @explode for strings. So here’s the general idea you’ll most likely need to use:
Convert your date to a string: var dateStr = @Text(dateValues)
Run explode on it: var outputDates:array = @Explode(dateStr,“,”)
Convert it back to a date type: @Date(outputDates)
I’m not completely sure about the last line as you may not be able to convert an array like this, you may need to recursively loop though each element and convert it. A quick for loop would do the trick.