to sort system date in a list, and special effect with sliders (XP)
Mark Smith
mark at maseurope.net
Tue Nov 29 09:52:50 EST 2005
Gunter, I usually store dates in yyyymmdd format, and I have
functions to convert back and forth from system date.
I'm assuming that the german system date is the same as the uk : dd/
mm/yy
You can sort a list by the result of a function.
My function for converting a dd/mm/yy date to yyyymmdd is :
function SSDateToDD aDate
if "/" is not in aDate then return aDate
set the itemDelimiter to "/"
put item 1 of aDate into dd
put item 2 of aDate into mm
put item 3 of aDate into yy
if length(dd) < 2 then put "0" before dd
if length(mm) < 2 then put "0" before mm
if length(yy) < 4 then
put char -2 to -1 of yy into yy
if yy > 50 then
put "19" before yy
else
put "20" before yy
end if
end if
return yy & mm & dd
end SSDateToDD
so you can sort a list like so:
sort lines of myList numeric by SSDateToDD(item 1 of each) --
assuming the date is the first item, of course
Hope this helps,
Mark
ps. your English is much better than my German, so apologies...
On 29 Nov 2005, at 14:34, gaich software service wrote:
> Hello all of this very helpful list,
>
> I am a consultant and supporter of a well known ERP-Software in
> germany.
> Since 6 months I am programming tools for that ERP-System and I do
> it with revolution.
> I think this was the best idea I've ever had.
> My customers are very happy to get the tools they need in a very
> short time and for a low price.
>
> Until now I wasn't an active user of this list, because my english
> isn't very good, as you see.
>
> I have a question about date sort in a list. Because my customers
> are german, they want to see the german date format (system date).
> Is there a way to sort a list by an item that contains a system date?
>
> I wrote a little function for this problem:
>
> function sortContainerBySystemDate pContainer, pItemToSort, pSortOrder
> local nOL
> local nOI
> local x
> if (pContainer is empty) or (pItemToSort is not a number)
> or (pItemToSort < 1) then
> put empty into sortedContainer
> return sortedContainer
> exit sortContainerBySystemDate
> end if
> set the itemDel to tab
> put the number of lines of pContainer into nOL
> put the number of items of line 1 of pContainer into nOI
> if nOL < 2 or nOI < pItemToSort then
> put pContainer into sortedContainer
> return sortedContainer
> exit sortContainerBySystemDate
> end if
> repeat for each line x in pContainer
> convert item pItemToSort of x from system date to seconds
> end repeat
> if pSortOrder = 1 then
> sort lines of pContainer descending numeric by item
> pItemToSort of each
> else
> sort lines of pContainer ascending numeric by item
> pItemToSort of each
> end if
> repeat for each line x in pContainer
> convert item pItemToSort of x from seconds to system date
> end repeat
> put pContainer into sortedContainer
> return sortedContainer
> end sortContainerBySystemDate
>
>
> It works for me. But may be there is a better and shorter way to do
> that!?
>
>
> Another Problem:
>
> Because my costumers are working on windows machines, they have
> very different Versions (98,2000,XP).
> I'm programming on a windows XP with Classic Style for Windows and
> gadgets.
> I did a tool that contains sliders and it works fine.
> I installed it on a customers machine with XP and XP Style. I was
> scared -- the knop of the slider was not there and there was no way
> to do anything with the slider.
> When I turned the Style to Classic on that machine, the knob was
> there again. But the employee wants to have the XP Style, hmmm.
>
> Is this a well known effect and is there a possible solution?
>
> Puuhhh, it takes longer time to write this little english text then
> to programm a little tool with Revolution :-)
>
> Best,
> Günter
> ----------------------------------------------------------------------
> --
>
> *gaich software service Günter Gaich
> *
> *fon: +49 (0) 6452-91101-55
> fax: +49 (0) 6452-91101-57
> mobil: +49 (0) 172 970 26 51
> service at gaich.de*
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list