Alpha Video Training
Results 1 to 7 of 7

Thread: Need to use a variable to set append.t_filter ?

  1. #1
    Member
    Real Name
    Jude Flanagan
    Join Date
    Feb 2012
    Posts
    6

    Default Need to use a variable to set append.t_filter ?

    Hi

    I'm creating a script to append a table made up of 11 x fields.

    master table = tab1
    transaction table = tab2
    All field names are the same in both tables
    Filter :

    Code:
    append.t_filter = "Cust_Id="00035""   If set as constant works OK
    What I want to do is use a variable from another table to set like as follows;

    dim vcust_id as c

    Load this variable from a field in another table and use it as the filter;

    Code:
    append.t_filter = "Cust_Id="00035""   works OK   Constant
    So, I want to replace this "Cust_Id="00035""
    with "Cust_Id= vcust_id but I can't see how to input this as a variable?
    I've looked at s_quote and quote but still can't see a solution. I know that it will be very simple?





    Any suggestions would be greatly appreciated.

    Kind regards
    JF
    Last edited by Al Buchholz; 11-29-2019 at 03:56 PM. Reason: added code tags

  2. #2
    Member
    Real Name
    Allen Klimeck
    Join Date
    Apr 2000
    Location
    Colorado
    Posts
    539

    Default Re: Need to use a variable to set append.t_filter ?

    append.t_filter = "Cust_Id=" + quote(vcust_id)

  3. #3
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,628

    Default Re: Need to use a variable to set append.t_filter ?

    Quote Originally Posted by Jude F View Post
    Code:
    append.t_filter = "Cust_Id="00035""   If set as constant works OK
    Any suggestions would be greatly appreciated.

    Kind regards
    JF
    Actually that doesn't work as a constant.

    But this would work - single quotes within the outer double quotes.
    Code:
    append.t_filter = "Cust_Id='00035' "   If set as constant works OK
    But Allen has given you the complete solution.
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  4. #4
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,699

    Default Re: Need to use a variable to set append.t_filter ?

    A little indirection might work too before the append portion to get the value into single quotes:

    dim vcust_id as c = cust_id.value 'if using a form get the field on the current record
    dim vFilter as c
    'spacing added to show the single quotes - omit
    vFilter = convert_expression("Cust_ID= ' "+vcust_id+ " ' ","V")
    ?vFilter
    = "Cust_ID= '00035'"

    append.t_filter = vFilter
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  5. #5
    Member
    Real Name
    Jude Flanagan
    Join Date
    Feb 2012
    Posts
    6

    Default Re: Need to use a variable to set append.t_filter ?

    Hi Allen,

    Sorry for the delay in my response but I've been away. Anyway, just to say thank you for your response. I thought that I tried his but obviously not.

    Kind Regards,

    JF

  6. #6
    Member
    Real Name
    Jude Flanagan
    Join Date
    Feb 2012
    Posts
    6

    Default Re: Need to use a variable to set append.t_filter ?

    Hi Robin,

    Thank you for taking the time to look at my issue and provide a solution. I will look at what you have proposed.

    Kind regards

    JF

  7. #7
    Member
    Real Name
    Jude Flanagan
    Join Date
    Feb 2012
    Posts
    6

    Default Re: Need to use a variable to set append.t_filter ?

    Hi Allen,

    Thank you also for taking the time to look at my issue and your response.

    Kind regards,

    JF

Similar Threads

  1. Append from variable?
    By RobPolley in forum Application Server Version 8
    Replies: 2
    Last Post: 04-14-2008, 09:50 AM
  2. Append from Variable
    By RobPolley in forum Alpha Five Version 8
    Replies: 6
    Last Post: 04-10-2008, 06:40 PM
  3. Append Variable value
    By Jimmie1234 in forum Alpha Five Version 5
    Replies: 7
    Last Post: 08-16-2004, 10:17 AM
  4. Variable append error
    By Gary Phillips in forum Alpha Five Version 5
    Replies: 9
    Last Post: 07-22-2004, 11:43 AM
  5. Variable in an append operation
    By tcampb in forum Alpha Five Version 4
    Replies: 3
    Last Post: 03-11-2002, 10:52 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
  •