SPONSORS:






User Tag List

Results 1 to 3 of 3
  1. #1
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Create new instance of a variable, knowing only the datatype?

    I want to write a generic function which can deal with different types of Record variable. What I would like to do is to pass into this function a variable of type DATATYPE, and allow the function to create a new instance of this type.
    I have done some testing, and it is certainly possible to pass a DATATYPE variable into a function, and then use it (for example you can then successfully pass it into FieldsOfRecord()), but I don't know of a way of creating a new instance of this variable type.
    Here is an example of what I have managed to do so far:
    Does anybody know how I can manage to go on and create a variable of this datatype? Or is the DATATYPE type only useful for the FieldsOfRecord function?

    ------------------


    [This message has been edited by vincebowdren (edited 04-04-2001).]

  2. #2
    Member
    Join Date
    Nov 2000
    Location
    Shelton, CT, USA
    Posts
    32
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Create new instance of a variable, knowing only the datatype?

    I have never found a way to create a new instance of a record type. Have you tried using the anytype DATATYPE. This will allow you to pass any type of variables into a function. Once the variable, with its data, is in the function, you can resolve the datatype and then work with the variable type and data. If necessary you can then also pass the variable back out as a anytype.
    Hope this made some sense.

    ------------------


    [This message has been edited by mvpl (edited 04-04-2001).]

  3. #3
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Create new instance of a variable, knowing only the datatype?

    Segue tech support just got back to me on this one; they said there is no way of doing it. So I've gone with the workaround of passing in an instance of my variable type into the function.

    ------------------

 

 

Posting Permissions

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

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 03:53 AM.

Copyright BetaSoft Inc.