Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Unique username with own prefix

edited February 2012 in General
Hello,

I'm looking for a way to generate unique usernames with my own prefix
instead of the component.classname, which GetUniqueUserName is using.

Is there a way to use my own counter and check if the username generated
that way is unique or to let RB-routines use my own prefix?

Kind regards,
Mark

Comments

  • edited February 2012
    Hi Mark,

    There is no automatic way to do this. You could use the
    OnComponentCreate event of the designer to assign your own name/username
    which fires after the original is set.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2012
    Hi Nico,

    but I would still need a way to generate such an unique username and / or to
    check if the one I've generated is unique or if I need to increase the
    counter or something like that.

    I need to replace some DBMemos with some DBRichTexts. There can be different
    amounts of them in the templates and there also can be some DBRichTexts,
    which have the desired username prefix already, so that I would need to
    start with different counters theoretically.

    Looks as if I will have to go through all the components in a loop and
    check, if one of them already has a username, I generated for the new
    component.


  • edited February 2012
    > Looks as if I will have to go through all the components in a loop and

    Correct. As I mentioned before, there is no automatic way to do this.
    ReportBuilder gives you a way to change the username, the rest must be
    done manually. Something similar to the GetUniqueUserName routine perhaps.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2012
    Just a feedback to this:

    apparently it's not even necessary to generate an unique username. Once I
    assign the same username to another component (second in my case), it
    automatically gets a "1" added to the username I've assigned.

This discussion has been closed.