Welcome to DirectSmile

VDP/DSMI - Interface form and user input forced format

link this post written on 02/04/2013
  • To top

Hello

We have to format a variable in document from a input text in a DSMI form, when we can’t force the user to input his text in the good format.

I don’t know if it’s clear enough…

So, an example :

We have to print a tel number only like this : 00 00 00 00 00

In DSMI form (integrated in a web-site), the user can input 0000000000, or 00.00.00.00.00, or 00 00, and others…

Can we reformat the user’s inputs as what we want to ?

Rene et Cyrille (the great DSM Trainers ) recommanded us to make a VBScript message box to block and alert the user, but, we'd prefer another solution to automaticlly reformat the input text. Some VDP tools make this, maybe DSM would be able to do something like this...

Some additional information : our documents are corporate's document made with Indesign CS6 and VDPStudio. We can set the interfce variable in VDP or in the DMSI. 

If you’ve got a solution, or maybe just the begin of it… it would be great !

Many thanx for your help.

Erwann

link this post written on 02/04/2013
  • To top

Hi Erwann,

I would delete all dots and spaces from the string to have always the same source and separating this string now 2 digits wise by the needed space.

I hope this helps

Regards
Wolfgang

link this post written on 02/04/2013
  • To top

Hello Wolfgang

Thanks for your help.

It's what we want to do... but have we to create a vbscript function in VDPStudio to do this (and upload all the doc to DSMI) ?... We try to do this, but the result was not good ... our VBScript level is maybe too low

Or is this would be better to do it in DSMI ? 

Thank for more help (maybe )

link this post written on 03/04/2013
  • To top

Hello Erwann,

Here a solution for VDP Studio:

First of all you need two variables, one for the input and a separate one for the output.
Each document variable will be handled one time only for each record set in a job. All document variables are stored and handled more or less in the order of syncing in, independent from the order in the InDesign Bridge, except they are in different allocation cycles. These cycles can be set by right click to the variable in then Bridge and choosing "Properties".
Default cycle "1" is good for incoming data to the document. Variables containing scripts or formulas to read and handle these data need to be in cycle "2". Variables which receiving this manipulated data need to be in cycle "3". More than 3 cycles are rarely in use.

cycle setting

This is necessary because in Directsmile VDP a variable cannot modify its input into a different output value. Also all variables of a document are stored in one pool and will be handled in the order of syncing except they are set in different calculation cycles.

Now the script for the output variable can look like this:

Function myDocOutputVariable()
  inp = replace(replace(Var.Gets("myDocInputVariable"), ".", ""), " ", "")
  for i = len(inp)-1 to 1 step -2
    outp = Mid(inp, i, 2) & " " & outp
  next
  if i=0 then outp = left(inp, 1) & " " & outp
  myDocOutputVariable = outp
End Function

Regards
Wolfgang

P.S.: A documentation for the VBScript commands is available at the Microsoft Site,
a documentation about the used DS extension "var.Gets" can be found here.

The author has edited this post (on 03/04/2013)
link this post written on 03/04/2013
  • To top

many thanx and congratulations

Your script is perfect. It does what we need,  you're our "savior"  ! And it works even in the Offline Configurator. Now I have to find how to use it from DSMI to our e-shop... 

 

I asked Cyrille to thank you, I hope he did. If he doesn't you can scold him for me (this is joke :D)

 

best regards 

link this post written on 03/04/2013
  • To top

You're welcome!

When you brought this to work in the Configurator it should also work in the DSMI using a Job DB, an XML structure, or a fixed text.

Best regards
Wolfgang

  • Statistics: 6 Posts | 31 Visits
created by mixxt
  • v1.1.1
  • (highfive)