It is easy: <dtml-call "REQUEST.set('signumfix2',signum2[1:4])"> <dtml-call "REQUEST.set('signumfix2', _.int(signumfix2)+1)"> <dtml-call "REQUEST.set('signumFinal', 'B' + _.str(1000 + signumfix2)[1:] )"> DTML is simple and fine :) ----- Puvodní zpráva ----- Od: Ebbe Kvist I want to process a variable, signum2, which is picked up from a MySQL database. The content of the variable is "B006". The aim is to process this variable so the result will be "B007" and it will then be saved as part of a new record in the database. The core process is to increment the integer part of the variable "006" with 1. I have successfully done this incrementation but I have not been able to create a new correct content for the new varable new_xyz. <dtml-call "REQUEST.set('signumfix2',signum2[1:4])"> <dtml-call "REQUEST.set('signumfix2', _.int(signumfix2)+1)"> How can I from here create the correct content of the new variable? I need to bring the "B" part with me and then the incremented integer part formatted with two preceeding zeroes. Does anyone know?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jaroslav Lukesh wrote:
It is easy:
<dtml-call "REQUEST.set('signumfix2',signum2[1:4])"> <dtml-call "REQUEST.set('signumfix2', _.int(signumfix2)+1)"> <dtml-call "REQUEST.set('signumFinal', 'B' + _.str(1000 + signumfix2)[1:] )">
Hopefully such code won't be released :-) - -aj -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkxmOq4ACgkQCJIWIbr9KYy0uQCeId0CiRMj0xKmV9t3dGvkyqgp r9gAoKiFkmFZVspPnwMAJMEcKFrAAE8o =pblK -----END PGP SIGNATURE-----
----- Puvodní zpráva ----- Od: "Andreas Jung" <lists@zopyx.com>
Jaroslav Lukesh wrote:
It is easy:
<dtml-call "REQUEST.set('signumfix2',signum2[1:4])"> <dtml-call "REQUEST.set('signumfix2', _.int(signumfix2)+1)"> <dtml-call "REQUEST.set('signumFinal', 'B' + _.str(1000 + signumfix2)[1:] )">
Hopefully such code won't be released :-)
It was for illustration only, here is the better one: <dtml-call "REQUEST.set('signumFinal', 'B' + _.str(1001 + _.int(signum2[1:]))[1:])"> DTML is your friend, not evil. JL.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jaroslav Lukesh wrote:
----- Puvodní zpráva ----- Od: "Andreas Jung" <lists@zopyx.com>
Jaroslav Lukesh wrote:
It is easy:
<dtml-call "REQUEST.set('signumfix2',signum2[1:4])"> <dtml-call "REQUEST.set('signumfix2', _.int(signumfix2)+1)"> <dtml-call "REQUEST.set('signumFinal', 'B' + _.str(1000 + signumfix2)[1:] )">
Hopefully such code won't be released :-)
It was for illustration only, here is the better one:
<dtml-call "REQUEST.set('signumFinal', 'B' + _.str(1001 + _.int(signum2[1:]))[1:])">
Ugliness is in the eye of the beholder. *shrug* :-) - -aj -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkxnfxEACgkQCJIWIbr9KYwQlACfX/BPuBMzMk+HfdfG1zrDl1D5 ALcAoIdzCYk8X+NsqGIm2p/2jK+Up8vW =8jNW -----END PGP SIGNATURE-----
Am 14.08.2010 22:23, schrieb Jaroslav Lukesh:
DTML is your friend, not evil.
JL.
when I was a kid I used to spend my holidays with my grandfather. he was an old farmer and used to work with horse and carriage. it was great and I loved the horses..
participants (3)
-
Andreas Jung -
Jaroslav Lukesh -
robert rottermann