Alpha DevCon 2018
Results 1 to 4 of 4

Thread: Can you use a Pointer or Dot variable to build a string ?

  1. #1
    Member bob9145's Avatar
    Real Name
    Bob Senski
    Join Date
    Jun 2009
    Posts
    745

    Default Can you use a Pointer or Dot variable to build a string ?

    concatenate_required_fields = "amount=" + required.amount + "&interval=" + required.interval + "&product[name]=" + required.product_name + "&currency=" + required.currency)

    ?concatenate_required_field
    ="("amount=2500&interval=month&product[name]=Silver&currency=usd)"


    This is a lot of typing, could this be turned into a function that took the required dot variable and turned it into the needed string? Here is the twist
    the number of fields in the dot variable may change, for instance the above may also include more or less required.fields.
    Function concatenate_in_curl_format(required,8) 8 being the number of required fields included in the dot variable.

    Guess my first step would be parsing the variable. The function would have to detect the required.dots it contained. How can a function dissect the variable?
    Then it would have to build the string accordingly. Any xbasic functions or methods to help with this?

  2. #2
    Member bob9145's Avatar
    Real Name
    Bob Senski
    Join Date
    Jun 2009
    Posts
    745

    Default Re: Can you use a Pointer or Dot variable to build a string ?

    dim required as p
    dim required.amount as n
    dim required.currency as c
    dim required.plan as c
    required.amount = "3000"
    required.currency = "usd"
    required.plan = "gold"
    ?required
    = amount = 3000
    currency = "usd"
    plan = "gold"

    So how do I use ?required in a xbasic script and evaluate and utilize the result?

  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: Can you use a Pointer or Dot variable to build a string ?

    lst = properties_enum(required)

    out = ""
    for each foo in lst
    out = out + "required."+ foo.value+" is type "+typeof(eval("required."+foo.value))+crlf()
    next
    ? out
    = required.amount is type N
    required.interval is type C
    required.product_name is type C
    required.currency is type C
    There can be only one.

  4. #4
    Member bob9145's Avatar
    Real Name
    Bob Senski
    Join Date
    Jun 2009
    Posts
    745

    Default Re: Can you use a Pointer or Dot variable to build a string ?

    Thanks Stan! that .s me in the right direction!
    Last edited by bob9145; 03-17-2018 at 01:40 PM.

Similar Threads

  1. 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
  2. Finding variable string patterns in a longer string
    By Ted Giles in forum Alpha Five Version 11 - Desktop Applications
    Replies: 11
    Last Post: 06-06-2015, 03:01 AM
  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. 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
  5. Concatenating a string variable to a pointer varia
    By Everett Sheldon in forum Alpha Five Version 5
    Replies: 2
    Last Post: 02-16-2005, 05:13 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
  •