Hi Emmanuel,
I think you should try with double-quotes, and you should also consider
using another variable for your final string, like newSt, so there is no
confusion between them.
Something like this :
<string><![CDATA[
var st = java.lang.String(srcBean.getDatasetFirstValueById("st"));
var newSt = "";
switch (st) {
case "61":
newSt = java.lang.String("Orne");
break;
case "50":
newSt = java.lang.String("Manche");
break;
default:
newSt = java.lang.String("Calvados");
break;
}
newSt
]]></string>
David
Le 12/10/2012 17:21, Emmanuel Lesouef a écrit :
> Hi,
>
> Being new to this list, I hope my question won't be considered as a
> newbie one.
>
> First of all, I am not a Javascript developper, so...
>
> I would like to motify the data retrieved from an LDAP server before it
> is sync'ed to the destination LDAP server.
>
> Here is the code I put in a dataset :
> <dataset>
> <name>st</name>
> <policy>FORCE</policy>
> <defaultValues></defaultValues>
> <forceValues>
> <string><![CDATA[
> var st = java.lang.String(srcBean.getDatasetFirstValueById("st"));
> switch (st) {
> case 61:
> st = java.lang.String("Orne");
> break;
> case 50:
> st = java.lang.String("Manche");
> break;
> default:
> st = java.lang.String("Calvados");
> break;
> }
> st
> ]]></string>
> </forceValues>
> <createValues></createValues>
> </dataset>
>
> On the first run, I enclosed the number of the departement with double
> quotes (ie : case "61"). Every 'st' has been rewrote "Calvados".
>
> Now that I removed the double-quotes, no modification are applied on
> the destination st's.
>
> How can I code something that replaces the departement code with its
> textual meaning ?
>
> Thanks for your help.
>
> PS : Sorry for the probably malformed indentations.
>
_______________________________________________________________
Ldap Synchronization Connector (LSC) - http://lsc-project.org
lsc-users mailing list
[email protected]
http://lists.lsc-project.org/listinfo/lsc-users