Trust ID PBCEX logo 300x102

leftpad function

5 years 4 months ago
vandenberg
Expert Boarder
Expert Boarder
Posts: 106
More
Topic Author
leftpad function #4905
hello,

Where can i put a code on a field 2 add zero's prefix until 8 digits?
for example LeftPad(cardnumber;8;0)
5 years 4 months ago
Rutger Koperdraad
Platinum Boarder
Platinum Boarder
Posts: 1566
More
leftpad function #4907
Hello Vandenberg,

In the designer, when you select the text object and open the content tab of the properties window, you can set the format to type Integer and format d8. That ensures that the resulting number always has at least 8 digits, with leading zeroes when needed.

regards,
Rutger.

Rutger Koperdraad
Senior Software Engineer

"A reasonable man adapts himself to the world. The unreasonable man persists in trying to adapt the world to himself. All progress, therefore, depends on the unreasonable man." (Bernard Shaw)
5 years 4 months ago
vandenberg
Expert Boarder
Expert Boarder
Posts: 106
More
Topic Author
leftpad function #4909
Hello Rutger,

yes i know this but it is like this: we have personal number which is a field on the card but we also have codenumber which is the 8 digits leading zero from number.
the codenumber isnt a field on the cardlayout but is used for encoding puerposes.
can you tell me where 2 do this? i also dont see the option leading zero's . is there a screenshot somewhere?
5 years 4 months ago
Rutger Koperdraad
Platinum Boarder
Platinum Boarder
Posts: 1566
More
leftpad function #4912
Hello Vandenberg,

It is not very clear to me. In version 7 and higher you can map both card objects and MIFARE write items in the designer and you can use formats, concatenations and scripts in order to get exactly the combination of fields you need. To map MIFARE items in the designer, you need to select the Data tab on the left hand side of the Designer window, select MIFARE write items on the bottom of the Data tab and then select the item you want to map. MIFARE read items are available in the drop-down menu on the Content tab of the Properties window.

If this information is not enough to achieve what you need, please explain the situation in more detail.

kind regards,
Rutger.

Rutger Koperdraad
Senior Software Engineer

"A reasonable man adapts himself to the world. The unreasonable man persists in trying to adapt the world to himself. All progress, therefore, depends on the unreasonable man." (Bernard Shaw)
5 years 4 months ago
vandenberg
Expert Boarder
Expert Boarder
Posts: 106
More
Topic Author
leftpad function #4913
Hello Rutger,

yes i know this but its like this:
we have 2 database colums:

1:codeernummer which is 123456
2:codeernummer8 which must be Always 8 digits with leading 0.

we dont print nr2 but we need this to be automatically filled when something is written in 1.
we use 2 as a database field for encoding purposes.
we dont need todo anything with mifare options
5 years 4 months ago
Rutger Koperdraad
Platinum Boarder
Platinum Boarder
Posts: 1566
More
leftpad function #4914
Hi Vandenberg,

You can fill the field automatically when printing, by creating a storage item and mapping it with the correct format, but not when editing the database data. This sounds like you need to create an insert or update trigger in your database. With triggers you can fill codeernummer8 as soon as a record is added or modified.

regards,
Rutger.

Rutger Koperdraad
Senior Software Engineer

"A reasonable man adapts himself to the world. The unreasonable man persists in trying to adapt the world to himself. All progress, therefore, depends on the unreasonable man." (Bernard Shaw)
5 years 4 months ago
vandenberg
Expert Boarder
Expert Boarder
Posts: 106
More
Topic Author
leftpad function #4915
Hello Rutger,

The field must be filled before printing becuase we first encode the mifare with this field.
With sql you can give a field certain conditions and when you edit codeernummer it wil automatically refresh and update codeernummer8.
is suchinsert or update trigger possible within cardexchange? where can i make triggers?
5 years 4 months ago
Rutger Koperdraad
Platinum Boarder
Platinum Boarder
Posts: 1566
More
leftpad function #4916
If you use CardExchange to encode the MIARE card, you can map the MIFARE item directly to codeernummer and apply the correct formatting with CardExchange. If you need the field codeernummer8 for other purposes after printing, you can create a storage item on that field and map the storage item to codeernummer, again with the correct formatting.

If that does not work for you (but I do not understand why it wouldn't), you need to arrange the left padding in your database, either using triggers or by creating the padded field with a view.

regards,
Rutger.

Rutger Koperdraad
Senior Software Engineer

"A reasonable man adapts himself to the world. The unreasonable man persists in trying to adapt the world to himself. All progress, therefore, depends on the unreasonable man." (Bernard Shaw)
×

Notice

The forum is in read only mode.