Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IStringMap example with DATE as key
#1
I would welcome any comments on the following example. Actually, I wonder whether there exists a more simple - elegant way to modify it. Many thanks in advance.

Macro temp04
Code:
Copy      Help
out
IStringMap m
if(m=0)
,m._create
else
,m.RemoveAll

m.Flags=8

m.Add("130937158400000000"  "ShowAlfa")
m.Add("131066700210000000"  "BfFTreeExe")
m.Add("130937974030000000"  "CreateDirExe")
m.Add("131018615550000000"  "SearchForFoldersInDir")
m.Add("130938009830000000"  "SearchForAFolderInDir")
m.Add("131063516250000000"  "SES_FileSysSearch")
m.Add("130937048660000000"  "Select_FilesExe")
m.Add("130936117220000000"  "ProcessNotepadFileSItem")

int i
ARRAY(str) ak av
m.GetAll(ak av)
for(i ak.len-1 -1 -1)
,long ld=val(ak[i] 1)
,DATE d=ld
,_s=d
,out "%i. %s %s" i+1 _s av[i]
,,
#2
Probably simpler would be to specify date string like "2016-05-02 13:40:21". Or a DATE variable or DateTime variable. I can help to convert if you need it.
#3
This is what I actually add.
Quote:DATE d
long ldt
d=q.datemod
ldt=d
m.Add(F"{ldt}" F"{q.name}")

Is there something wrong with it? As a matter of fact it works.
#4
Macro Macro2726
Code:
Copy      Help
out
IStringMap m
if(m=0)
,m._create
else
,m.RemoveAll

m.Flags=8

DATE u
u="2016-05-02 13:40:21"
m.Add(_s.from(u.date) "ShowAlfa")
u="2016-04-28 21:13:45"
m.Add(_s.from(u.date) "BfFTreeExe")

int i
ARRAY(str) ak av
m.GetAll(ak av)
for(i ak.len-1 -1 -1)
,DATE d=val(ak[i] 2)
,_s=d
,out "%i. %s %s" i+1 _s av[i]
,,

DATE.date type is double. Don't need to convert to/from long.
#5
Fine! Many thanks indeed.


Forum Jump:


Users browsing this thread: 2 Guest(s)