CheeseDog Posted December 15, 2009 Posted December 15, 2009 Does anyone have a list of the functions for generating eportal usernames in CMIS? One of the default templates looks something like this RemoveVowels(contact.Forename + contact.Surname) So if you're name was Arthur Brain it the username would be rthbrn I've worked out how to add a prefix but I'd like it to generate a random number after this at least four characters long.
SkywOrca Posted December 15, 2009 Posted December 15, 2009 (edited) To the best of my knowledge, there is no random function in the reports engine. The best I could suggest, if you want to create a non-guessable user name, would be to compile some sort of munge based on other elements from the users name, kind of depends on how complex you want to get with it. One quick example of a number munge would be: n := Contact.Name; o := 1; Loop(n > '', (o := o * Replace(Upper(Left(n, 1)), 1, 'A', 2, 'B', 3, 'C', 4, 'D', 5, 'E', 6, 'F', 7, 'G', 8, 'H', 9, 'I', 10, 'J', 11, 'K', 12, 'L', 13, 'M', 14, 'N', 15, 'O', 16, 'P', 17, 'Q', 18, 'R', 19, 'S', 20, 'T', 21, 'U', 22, 'V', 23, 'W', 24, 'X', 25, 'Y', 26, 'Z', 27); n := Right(n, -1))); Abs(o) % 9999 Not tested this in the generate usernames area, mind you, but it should probably work. Edit: Just tested it, and it should work fine, I reused the Student contact - Template 3 and entered: n := contact.surname + contact.forename; o := 1; Loop(n > '', (o := o * Replace(Upper(Left(n, 1)), 1, 'A', 2, 'B', 3, 'C', 4, 'D', 5, 'E', 6, 'F', 7, 'G', 8, 'H', 9, 'I', 10, 'J', 11, 'K', 12, 'L', 13, 'M', 14, 'N', 15, 'O', 16, 'P', 17, 'Q', 18, 'R', 19, 'S', 20, 'T', 21, 'U', 22, 'V', 23, 'W', 24, 'X', 25, 'Y', 26, 'Z', 27); n := Right(n, -1))); StripNonAlphaNumChars(contact.surname + contact.forename) + Right('000' + Str(Abs(o) % 9999), 4) which successfully generates usernames with a four digit unguessable munge code appended. Edited December 15, 2009 by SkywOrca 1
CheeseDog Posted December 15, 2009 Author Posted December 15, 2009 Cheers, worked a treat. Do you have list of the functions you could send me?
SkywOrca Posted December 15, 2009 Posted December 15, 2009 It uses functions available in the reports engine (possibly with some limitations). There is no current definitive document of functions that are available, however I have been attempting to compile one for some time. Hopefully I'll be able to release this soon, which should go up on the Link2ICT website.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now