SPONSORS:






User Tag List

Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    Sep 2001
    Posts
    69
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default values for record fields

    I have a record data type and I want to give all the fields default values. It doesn't look like I can do the following. I keep on getting a syntax error. Is there any way to assign a default value to a field within a record?

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

  2. #2
    Member
    Join Date
    Jun 2001
    Location
    Bedford, MA, USA
    Posts
    85
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Default values for record fields

    I don't know of a way to set real default values for a record. What I do instead is create an initialization record for that type and use it to initialize the record variable.

    code:
    ---------------------------------------------
    // This is the initialization record
    const TICKET_INFO TICKET_INFO_INIT = {...}
    "default value" // sJobName
    "default value" // sCopies
    "default value" // sDateTime
    "default value" // sDescription
    NULL // eType
    "default value" // sProduct

    // Initialize a TICKET_INFO variable
    TICKET_INFO MyTicket = TICKET_INFO_INIT
    ---------------------------------------------



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

  3. #3
    Super Member
    Join Date
    Jul 2001
    Location
    Earth
    Posts
    1,882
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Default values for record fields

    What you are asking for is a great idea. It was logged as an enhancement request a long time ago. You will have to initialize the values 'manually' after the record type is defined.

    ------------------
    James Soderborg
    http://www.ameliortech.com
    jamesso@ameliortech.com

  4. #4
    Member
    Join Date
    Sep 2001
    Posts
    69
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Default values for record fields

    I was hoping I wouldn't have to do it manually for each and every time I create a record of this type but it looks like I will have to. Actually I think Jim's initialization idea will work for what I want to do. I will try it out.

    I will also check out the enhancement thread to see if I can add this feature to it. I hope the Segue marketing/sales/engineering team all look at that thread every so often.

    Thanks,

    - Joe

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

 

 

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 07:17 AM.

Copyright BetaSoft Inc.