Conditionally expand the number of leading zeroes #4026
We have made a generic CE definition which prints Mifare cards with mixed 4-byte and 7-byte Mifare IDs. In CE you can specify per definition if you want to read a 7- or 4-byte UID for storage, but not both. Furthermore, you can fill in upto how many characters you want to have leading zeroes applied.
So, when you fill in 8, the id 123456 will become 00123456, when you fill in 14, ABCDE12345678 will become 0ABCDE12345678, but a 4-byte UID of 12345678 will then become 00000012345678 and that's not what we want, it should stay 12345678. On the other hand a long id should not be truncated.
Conditionally expand the number of leading zeroes #4028
The problem is that if I turn off leading zeroes, there won't be any leading zeroes, which we do want to have. If I turn off the 7-byte uid option, and fill in 0 at "minimum number of digits" the number is truncated up until max. 8 characters.
If I turn on 7-byte option and fill in 0 at "minimum number of digits" the number 01234567ABCDEF gets truncated to 1234567ABCDEF, which should not happen.
So a 4-byte UID of 123546 should be stored as 00123546, a 7-byte UID of 1234567ABCDEF should be stored as 01234567ABCDEF.
I hope it's clear what I mean.
7 years 7 months ago
7 years 7 months ago by Sergio Agostinho.
Conditionally expand the number of leading zeroes #4029
CardExchange removes the leading zeros on the Mifare serial number except if you define a minimum number of digits, this is the same behavior as other windows application like the calculator for example. The only way to workaround the 4 bytes cards problem and remove the additional extra leading zeros when the minimum number of digits is 14 is to make a python script for that field to do it. Check the designer steps below for CardExchange 7 or higher and Ultimate version:
Add a text object to the card and map it as script like "formatSN(MifareSN)", this will call the function defined above and will create a variable named MifareSN which you need to map in the mappings window as Mifare serial number in hex format with a minimum number of 14 digits.
Conditionally expand the number of leading zeroes #4030
Okay, thanks for your clear answer. This means for us it's not possible to do, as we are currently using CE 6 Ultimate.
Now I'm thinking about invoking some custom execute script. If I'm correct, CE executes SQL INSERT statements to insert data in the database. If we could use a stored proc instead of that, I could write the INSERT in that stored proc and add additional SQL after that to fix the alignment.
Could this be possible?
7 years 7 months ago
7 years 7 months ago by Rutger Koperdraad. Reason: added info
Conditionally expand the number of leading zeroes #4038
I use mappings as variables for the data text object. Mappings can only be either visual items or storage items. If I use a script, the result (prefixed with zeroes) is only shown in the visual item and is not stored.
Maybe I'm missing some step I need to take in between to get the two linked together?
Conditionally expand the number of leading zeroes #4041
Indeed, on CardExchange 6 the designer doesn't allow storage items mappings using the scripting language, this is only possible on CardExchange 7 or higher because of the new designer available on the newer versions. Sorry but my brain was not in version 6 mode i my last answer.