Jump to content

Format rule or function?


Recommended Posts

I have a database with a number and a format field. The format field will always be 12 characters but the number field will vary from 8 to 10 characters.


Does anyone know a rule or function that will help me format the number field?



X = Space

V = Variable Number


Number Format Result

1234567890 XVVVVVVVVVV 1234567890

12345678 XVVVVXVVVXV 1234 567 8

Link to comment
Share on other sites

Thank you, after I posted this I took a crack at writing some code. Your's looks way better :)


var AccountNumber = ""  
var Counter = 0 

for (var i = 0; i<Len(Field("Account_Format")); i++)
var x = Field("Account_Format").substring(i,i+1);

if (x == "V")
AccountNumber += Field("Account_Numbers").substring(Counter,Counter+1); 
else if (x == "X")
AccountNumber += " ";
return AccountNumber

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...