Want to get rid of Google Ads, click here.
+ Reply to Thread
Results 1 to 4 of 4

Thread: Do you want to allow only some characters in a field. How ca

  1. #1
    Senior Member eisefr's Avatar
    Join Date
    Nov 2001
    Location
    Germany
    Posts
    538

    Default

    Hello together..



    I just did something what you may want to use too.

    We have a field (ansprechpartner) . It holds the name of the contact-person.

    It was pretty anoying for me when the call agents wrote some sh*t in this field.

    Like "???" or "***" or other stuff like this..



    So i made this:



    i wanted to check if a field (in this example "ansprechpartner") haves only allowed characters.. you can do this with the format control:





    1st step:



    Modify the formatcontrol in the calculation-tab like this:



    Add= true

    Upd=true



    Calculation:



    $error=true;$ok="abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZäÄÖöüÜß-.";$ln=lng(ansprechpartner in $file);for $c = 1 to $ln do ($temp=substr(ansprechpartner in $file, $c, 1);if (index($temp, $ok)=0) then ($noerror=false))







    2nd step:

    Modify the formatcontrol in the validation-tab like this:

    add=true

    upd=true

    validation: $noerror

    message: Your message what you want to bring up when a wrong character was found in the current field.







    The variable $ok holds all characters which are allowed to use. You can change that as you want it to have.

    the variable $ln is the lengh of the field ansprechpartner.

    the variable $noerror mußt be true. If it is false.. it brings your message in the status line.











    All this together checks if the field hold only characters like

    abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZäÄÖöüÜß-.



    If you want to build a emailaddress with this field... (thats case in my system) you should check if they

    fill out the first AND the lastname completly.. instead of "Hr. Eisenhauer" they should write "Frank Eisenhauer"



    So i changed the query from step 1 like this:

    $noerror=true;$ok="abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZäÄÖöüÜß-.";$ln=lng(ansprechpartner in $file);for $c = 1 to $ln do ($temp=substr(ansprechpartner in $file, $c, 1);if (index($temp, $ok)=0) then ($noerror=false));

    if (index(" ", ansprechpartner in $file)=0) then ($noerror=false);if (substr(ansprechpartner in $file, 1, 2)="Hr" or substr(ansprechpartner in $file, 1, 2)="HR" or substr(ansprechpartner in $file, 1, 3)="Fr." or substr(ansprechpartner in $file, 1, 3)="FR." or

    index(" ", ansprechpartner in $file)=0 or substr(ansprechpartner in $file, 1, 4)="Herr" or substr(ansprechpartner in $file, 1, 5)="Frau ") then ($noerror=false)



    This query looks for allowed characters AND also for short forms like Hr. Herr, Fr. Frau.





    That works pretty fine..



    Maybe some of you guys can and want to use it.



    If there are any questions about that...

    Write me back.



    Bye from Germany.

    Frank

  2. #2
    Member Warlei Figueiredo's Avatar
    Join Date
    Mar 2007
    Location
    Brasil
    Posts
    43

    Default

    Please, check out your code. I believe there is a error on first code. When you describe the calculation:

    Calculation:

    $error=true;$ok="abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZäÄÖöüÜß-.";$ln=lng(ansprechpartner in $file);for $c = 1 to $ln do ($temp=substr(ansprechpartner in $file, $c, 1);if (index($temp, $ok)=0) then ($noerror=false))

    Doesn't exist the "$error" variable when you test it in "validation" tab.

    I tested here end after has been changed the "$error" to "$noerror" it works fine.
    Warlei Figueiredo

    ITIL certified
    Accredited Integration Specialist – HP OpenView Service Management

  3. #3
    Junior Member
    Join Date
    Jun 2008
    Posts
    5

    Default

    Hi there,
    Could I use this type of calculation to "re-calculate" values in a field?

    I have a assignment field which is populated from the current.pending.approval.....but when populated adds a "1:" value to the assignment group(from a dependant macro)

    I want to recalcuate the value in this field to remove the "1:" and post a valid assignment group?

    regards
    Andy

  4. #4
    Senior Member eisefr's Avatar
    Join Date
    Nov 2001
    Location
    Germany
    Posts
    538

    Default

    This should do it:
    assignment in $file=strrep(assignment in $file, ":1", "")
    Frank

    • If it happens once, it's a bug.
    • If it happens twice, it's a feature.
    • If it happens more than twice, it's a design philosophy.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts