New call-to-action
Results 1 to 6 of 6

Thread: Ask Variable and Contains

  1. #1
    Member
    Real Name
    Al Smith
    Join Date
    Feb 2002
    Posts
    65

    Default Ask Variable and Contains

    Field = Salesmen
    Ask Variable = WhatSalesmen

    Salesmen is a character field with a length of 50,so we can input free text.

    Rec #1 The field Salesmen contains "Joe, Bob, Jake, John"
    Rec #2 The field Salesmen contains "Bob, Luke, Peter"
    Rec #3 The field Salesmen contains "John, Paul"
    The input to the ask variable = Bob

    I would expect rec #1 and #2 to be found, but no records are being found.

    I've tried contains(var"WhatSalesmen, Salesmen)but it did not work.

    I've tried setting a new variable to equal the field salesmen, then compare the to variables, but that did not work.

    Any help would be appreciated.

    Thanks in advance.

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default RE: Ask Variable and Contains

    Well, when I read the documentation for contains() and see

    "The target to examine, a character string containing words separated by space characters."

    I don't think a string of names separated by commas is the same thing.

    So you can either have the "input free text" enterers exclude the commas or you can do it for them with a form event rule or similar.

  3. #3
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default RE: Ask Variable and Contains

    I also think you have

    contains(var"WhatSalesmen, Salesmen)

    backwards. To search the field Salesman for the word in the ask variable

    CONTAINS( Search_String as C or target, Find_Words as C or words to find)


    contains(Salesmen,var"WhatSalesmen)

    but since your are only looking for one word you may want

    $ (Substring Inclusion Operator)
    Syntax
    Logical Result = Find_String as C $ Search_String as C

    var"WhatSalesmen $ Salesmen

  4. #4
    Member
    Real Name
    Al Smith
    Join Date
    Feb 2002
    Posts
    65

    Default RE: Ask Variable and Contains

    I don't know if this makes a difference or not, but the filter I am attempting is on a subreport, of a set's report,with one to many links. The table that the report filters is a child table.

    I have gotten the report to work to the extent it returns only one, or two, of the anticipated records, out of a possible 50 or more.

  5. #5
    Member
    Real Name
    Al Smith
    Join Date
    Feb 2002
    Posts
    65

    Default RE: Ask Variable and Contains

    I think I may have stumbled on a solution, but not sure how to correct it. It lies in the linking fields.

    The linking field in the parent table is Salesman, where I've given each salesman a unique name, as opposed to using the salesman's first name.

    The child table has a salesmen field, where the unique salesman's name is entered.

    Naturally, where only 1 name is entered, the record is found, but when more than 1 name it is not found. It does not matter where there names are separated by spaces, a comma, or all run together.

    So, it would seem, I must devise a way to connect the linking fields, but can't figure out how.

  6. #6
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,204

    Default RE: Ask Variable and Contains

    Al:
    ""I would expect rec #1 and #2 to be found, but no records are being found. ""
    You won't find BOB, but you will find "Bob,"
    "bob," is seen by alpha as one word, the coma is read as part of the name !!!
    Gabe

Similar Threads

  1. Variable Help
    By Tim Sutherland in forum Alpha Five Version 5
    Replies: 8
    Last Post: 01-13-2005, 08:19 AM
  2. Using A Variable
    By Mortie in forum Alpha Five Version 5
    Replies: 6
    Last Post: 02-14-2004, 04:39 AM
  3. Ask Variable
    By Larry R Schneider in forum Alpha Five Version 5
    Replies: 2
    Last Post: 02-11-2004, 10:50 AM
  4. Variable value
    By GregOnline in forum Alpha Five Version 5
    Replies: 6
    Last Post: 10-15-2003, 12:12 PM
  5. set variable help @#$%
    By Tom Patten in forum Alpha Five Version 4
    Replies: 22
    Last Post: 02-20-2001, 04:48 AM

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
  •