Solved

Pad Left with Zeros in Formula Language

Posted on 2001-09-12
5
522 Views
Last Modified: 2013-12-18
In Lotus Notes R5 designer, we have a field that is defined as text, editable.  It represents a number.  We want it to be a full 8 characters, and if the user keys in less than 8 characters, we want to pad it automatically on the left with zeros.  Example: if user keys 12345, we want to automatically make it to be 00012345.  

What is the Formula Language (@...) command to pad left with zeros to a specific number of total characters?
0
Comment
Question by:blyons48
  • 2
  • 2
5 Comments
 
LVL 24

Expert Comment

by:HemanthaKumar
Comment Utility
Write this code in Input translation of the field,
max := 8;
len := @Length(num);
@if(len >= max; @left(num;max); @Repeat("0"; max-len) + num)

~Hemanth
0
 
LVL 1

Accepted Solution

by:
SAK earned 50 total points
Comment Utility
Try:
@Right("00000000"+inputfld;8)


SAK
0
 

Author Comment

by:blyons48
Comment Utility
SAK...your solution did the trick...simple and effective...thanks!
0
 
LVL 24

Expert Comment

by:HemanthaKumar
Comment Utility
What ?
0
 

Author Comment

by:blyons48
Comment Utility
HermanthaKumar,
Ah!  I just tried your solution as well, and it works too, and even more sophisticated than SAK's simple one-line solution.  I guess I just jumped on the simpler looking one.  I apologize.  If I could somehow share the points between both of your good working solutions, I would.  But I've already submitted the Accept Answer.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now