Alpha Video Training
Results 1 to 6 of 6

Thread: Initializing a pointer variable

  1. #1
    Member
    Real Name
    Mark Gallagher
    Join Date
    Feb 2017
    Location
    Sarasota, Florida
    Posts
    37

    Default Initializing a pointer variable

    I have a pointer defined as follows …

    DIM Append as P 'Array pointer

    DIM init_p as P 'used to initialize a pointer

    The Append pointer is used to define an array of dot variables

    append.m_key = ""
    append.t_key = ""
    append.m_filter = ""
    append.t_filter = ""
    append.type = "All"
    append.m_count = 7

    When I move on to another section of the program I want to initialize the Append pointer and I have been able to do this with the following statement ...

    Append = init_p

    Is there another way to initialize a pointer? I tried the following without success …

    Append = ""
    Append = {}
    Last edited by markG; 05-22-2018 at 04:37 PM. Reason: Initial message partially lost

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

    Default Re: Initializing a pointer variable

    Mark

    I'm confused.

    What does the other 'section of the program' mean?
    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.

  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: Initializing a pointer variable

    The append dot variable is already used by Alpha so you don't need to dim it.

    you may not use as variable names words that are part of the Xbasic language or the names of Xbasic classes or Xbasic objects.
    There can be only one.

  4. #4
    Member
    Real Name
    Mark Gallagher
    Join Date
    Feb 2017
    Location
    Sarasota, Florida
    Posts
    37

    Default Re: Initializing a pointer variable

    Well, the more I think about it there really is not another section to the program. All I meant was as I progress thru the program and reuse the Append. variable array I'd like to initialize it. I noticed while in debug mode that if it gets loaded with 10 variables, then as the program progresses it might get loaded with 7 variables. In debug mode I noticed the last 3 variables in the array are from the prior use. I'm not having a problem, this has more to do with house keeping.

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

    Default Re: Initializing a pointer variable

    I think you want to eliminate all the append.m_field#, append.m_exp# pairs after an append is run.

    My example is from the interactive editor. You can change the t. to append. for use in an append script.

    Code:
    t.m_count = 3
    t.m_field1 = "ABC"
    t.m_field2 = "M&M"
    t.m_field3 = "AYZ"
    t.m_exp1 = "ABC"
    t.m_exp2 = "M&M"
    t.m_exp3 = "AYZ"
    'for example
    ? t.m_exp2
    = "M&M"
    for qz = 1 to t.m_count
    evaluate_template("Delete t.m_field"+alltrim(str(qz)))
    evaluate_template("Delete t.m_exp"+alltrim(str(qz)))
    next
    'check result
    ? t.m_exp2
    ERROR: Property not found 
    t.m_exp2 subelement not found.
    There can be only one.

  6. #6
    Member
    Real Name
    Mark Gallagher
    Join Date
    Feb 2017
    Location
    Sarasota, Florida
    Posts
    37

    Default Re: Initializing a pointer variable

    Wow, thanks Stan!

Similar Threads

  1. xbasic pointer variable question
    By mikeallenbrown in forum Mobile & Browser Applications
    Replies: 1
    Last Post: 01-23-2018, 10:29 AM
  2. Passing a Pointer Dot Variable to another variable
    By preston2 in forum Alpha Five Version 11 - Desktop Applications
    Replies: 7
    Last Post: 07-25-2016, 10:48 PM
  3. how works a pointer variable
    By Ton Spies in forum Alpha Five Version 10 - Desktop Applications
    Replies: 6
    Last Post: 01-16-2010, 08:37 AM
  4. Populating a pointer variable
    By Edward W Larrabee in forum Alpha Five Version 9 - Desktop Applications
    Replies: 4
    Last Post: 12-04-2008, 01:42 AM
  5. help with pointer variable value contents
    By Mike Wilson in forum Alpha Five Version 9 - Desktop Applications
    Replies: 5
    Last Post: 08-04-2008, 09:55 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
  •