Home » U++ Library support » U++ MT-multithreading and servers » Witz and map variable
Re: Witz and map variable [message #37984 is a reply to message #37981] |
Tue, 27 November 2012 09:45 |
|
Zbych wrote on Tue, 27 November 2012 08:51 | Hi,
I would like to replace some numbers in witz script with string.
Do something similar to Format("%[0:OK;1:ERROR;???]s", error_code).
I guess that map variable should do the trick. Can someone show me example how to create and use map variable in witz?
|
Hi Zbych,
Using maps in witz is quite straightforward. You just pass it to Skylark in handler:SKYLARK(MyHandler,"path"){
int i=1;
ValueMap map; // ValueArray could be used as well
map.Add(0,"OK");
map.Add(1,"ERROR");
http("ID",i)("MAP",map).RenderResult("MyApp/template");
}
and then you can work with it in the template:element $ID in MAP is: $MAP[ID]
I haven't tested the code, hopefully I made no mistakes
Best regards,
Honza
|
|
|
Goto Forum:
Current Time: Fri May 10 22:51:04 CEST 2024
Total time taken to generate the page: 0.02988 seconds
|