You are viewing limited content. For full access, please sign in.

Question

Question

Tokens multi-value from sdk script

asked on January 29, 2014 Show version history

Hi.

 

 int totalPaginas = 0;
 LFDocument entrada = (LFDocument)this.Entry;
 totalPaginas = entrada.PageCount;
 int[] arreglo = new int[]{1,2,3};
 this.SetTokenValue("TotalPaginas",arreglo);

 

This previous code is a way for definition token multi-value? why function definition SetTokenValue(TokenName, object). When compiled code from script editor and

close this script code dialog and open this script code dialog and see script tokens , this variable TotalPaginas not setting how multi-value

 

How definition token multi-value from sdk script ?

 

Additionally if I manually create a multi-value token from the token script editor

not see how to add manual values. In previous documentation (Tokens 9.02.pdf White Paper) a section appears: value. This section is no longer present in the workflow token script editor 9.0

 

 

thanks

 

>>>>>>

 

Hola

 

int totalPaginas = 0;

LFDocument entrada = (LFDocument)this.Entry;
totalPaginas = entrada.PageCount;
int[] arreglo = new int[]{1,2,3};
this.SetTokenValue("TotalPaginas",arreglo);

 

En el codigo anterior , es la manera como yo asigno un token "multiples valores" pero pasandole los valores como un arreglo de enteros, luego esos valores los puedo recuperar y utilizar como yo considere. Sin embargo cuando compilo y refresco

el script editor observo que se genera automaticamente el token TotalPaginas pero no

esta marcada como multi-valor. Asi que supongo que lo que defini no es un token multi-valor y segun entiendo el token multi-valor es un token con varios valores.

 

Como debo definir correctamente un token multi-valor desde code ?

 

 

Adicionalmente si deseo crear manualmente un token multi-valor desde el script token editor

no veo como agregarle valores manuales, en documentaciones anteriores (Tokens White Paper 9.02.pdf ) aparece una seccion : value. Esta sección ya no esta presente en script token editor del workflow 9.0

 

Gracias.

 

 

 

tokens.png
tokens2.png
tokens.png (12.5 KB)
tokens2.png (157.63 KB)
0 0

Answer

APPROVED ANSWER SELECTED ANSWER
replied on January 29, 2014 Show version history

Hola Junior! 

 

Que tal esto? 

 

// Para "set" las paginas como un token multi-value
List<int> todasLasPaginas = new List<int>(){1,2,3};            
this.SetTokenValue("TotalPaginas", todasLasPaginas);
            
// Para conseguir las paginas (acqui, el tipo List<int> corresponde 
//  al valor que le dimos anteriormente)
List<int> paginas = this.GetTokenValue("TotalPaginas") as List<int>;
if (paginas != null) // para extra seguridad
{
   // Para agregar las paginas, consigua las paginas primero,
   //  agrega el nuevo numero a esa lista, y luego "set" el valor.
   paginas.Add(4);
   this.SetTokenValue("TotalPaginas", paginas);
}
            
paginas = this.GetTokenValue("TotalPaginas") as List<int>;
int total = paginas.Count; // Aqui "total" vale 4
this.DesignTools.Watch("Total", total);

 

Para experimentar con un "multivalue token" desde el menu "Script Parameters", puede utilizar el "punto y coma" (;) como en la figura siguiente (la figura tambien esta 'attached'):

 

 

 

 

Aqui el token %(TokenMV) tendra los valores A, B y C durante el test. 

 

Esto le responde la pregunta? Disculpe mi mal Espanol =).

 

- Flavio

 

edit: Hmm, it occurred to me that some people might need this translated; be sure to let me know if you need me to translate this answer!

multivalueTokens.png
5 0
replied on January 30, 2014

Hi Flavio 

Thanks

 

Not problem. I used google traductor =D.

 

But, image not visible for experiment "multivalue token" (please attach image file)

 

As a suggestion to Laserfiche: 
A listbox to select which language you want to see the entered text

 

====

 

Hola flavio. Gracias por responder

No hay problemas por el ingles utilizo google traductor mas un poco de intuicion

e imagenes para que quede claro la pregunta. 

 

Respecto a experimentar multivalue token no aparecio la imagen para guiarme

te agradeceria lo adjuntes para visualizarlo.

 

Como sugerencia a laserfiche:

Un listbox que seleccione en que idioma desea ver el texto ingresado

 

Gracias

 

 

 

 

0 0
replied on February 3, 2014

Ok, ahora la imagen esta incluida como 'attachment'! 

0 0
replied on March 7, 2014

Ok. Thanks

I go back

Flavio Kuperman

 

0 0

Replies

replied on January 29, 2014

Ok Thanks Ed Heaney

 

But, I casting this token "arreglo" (for example a list<int>) and not necessary use  index value this token "multi-value"

, I manually create a multi-value token from sdk editor ? For example:

 

SetTokenValue("TotalPaginas",1);

SetTokenValue("TotalPaginas",2);

SetTokenValue("TotalPaginas",3);

previous code replace values , so => TotalPaginas => { 3 } not {1,2,3}

 

Exist, a method "Add" for Token ? For example:

Token("TotalPaginas").Add(1);

Token("TotalPaginas").Add(2);

Token("TotalPaginas").Add(3);

 

Finally, because the token script editor this workflow 9.0 is not present
the values ​​section, when checkbox "multi-value" its checked (documentation pdf), is
more logical and intuitive.

In that scenario I would not suffice to use this.SetTokenValue ("TotalPaginas", arreglo);
and would need token "multi-values". Since I can apply to casting token "TotalPaginas".

 

Thanks.

 

======>

 

Ok. Gracias, Ed Heaney

 

Pero, yo puedo aplicar casting al token "arreglo" y luego utilizarlo (por ejemplo si en vez

de un int[] tengo un list<int>, con la instruccion gettokenvalue) y no necesariamente utilizar

el index de un token "multi-value".

 

¿ Yo puedo crear un token multi-value desde el sdk editor ?

Por ejemplo:

SetTokenValue("TotalPaginas",1);

SetTokenValue("TotalPaginas",2);

SetTokenValue("TotalPaginas",3);

El anterior codigo no agrega, reemplaza al final el token totalpaginas tiene el valor de 3

Existe un metodo Add para los tokens ?. Por ejemplo:

 

Token("TotalPaginas").Add(1);

Token("TotalPaginas").Add(2);

Token("TotalPaginas").Add(3);

=> TotalPaginas = {1,2,3}

 

Por ultimo, porque en workflow 9.0 en el script token editor no esta presente

la seccion values, cuando marcas el checkbox multi-value (segun pdf), es lo

más logico e intuitivo.

 

En que escenarios no me bastaria utilizar this.SetTokenValue("TotalPaginas",arreglo);

y necesitaria token "multi-values". Ya que puedo aplicar casting al token arreglo.

 

Gracias

 

 

 

 

 

 

 

 

 

 

 

 

1 0
replied on January 29, 2014

This feature worked for me when I tried out your script. In general, array values are always multi-valued... even if you don't set the checkbox in the grid or dialog.

 

The purpose of the checkbox is really to indicate to the workflow designer that some features should be enabled like the ability to set an index value from the token editor dialog.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.