DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    William Fields Guest

    "SET" variables and Properties...

    I'm having a hard time with the following logic.

    SET DELETED = THISFORM.SomeProperty

    I've tried a number of variations including...

    SET DELETED (THISFORM.SomeProperty)
    SET DELETED &THISFORM.SomeProperty
    SET DELETED EVAL(THISFORM.SomeProperty)

    But nothing works. The only thing I can get to work is this...

    LOCAL cSomeVar
    cSomeVar = THISFORM.SomeProperty
    SET DELETED &cSomeVar

    Does anyone know why this is? Am I doing something wrong?

    --
    William Fields
    MCP - Microsoft Visual FoxPro
    US Bankruptcy Court
    Phoenix, AZ







  2. #2
    Anders Altberg Guest

    Re: "SET" variables and Properties...

    >SET DELETED (THISFORM.SomeProperty)
    the ( ) are used when the variable is name
    >SET DELETED &THISFORM.SomeProperty

    & can't be prepended to object references.
    >SET DELETED EVAL(THISFORM.SomeProperty)

    Try EVAL("thisform.someproperty")
    It will work if the value is "YMD" and you SET DATE TO
    EVAL("Thisform.Text1.Value") or EVAL("Thisform.DateProperty")
    but not with value = "ON" and SET TALK.
    -Anders

    .. "William Fields" <Bill_Fields@azb.uscourts.gov> wrote in message
    news:3929c0fe$1@news.devx.com...
    > I'm having a hard time with the following logic.
    >
    > SET DELETED = THISFORM.SomeProperty
    >
    > I've tried a number of variations including...
    >
    > SET DELETED (THISFORM.SomeProperty)
    > SET DELETED &THISFORM.SomeProperty
    > SET DELETED EVAL(THISFORM.SomeProperty)
    >
    > But nothing works. The only thing I can get to work is this...
    >
    > LOCAL cSomeVar
    > cSomeVar = THISFORM.SomeProperty
    > SET DELETED &cSomeVar
    >
    > Does anyone know why this is? Am I doing something wrong?
    >
    > --
    > William Fields
    > MCP - Microsoft Visual FoxPro
    > US Bankruptcy Court
    > Phoenix, AZ
    >
    >
    >
    >
    >
    >




  3. #3
    Nancy Folsom [MS FoxPro MVP] Guest

    Re: "SET" variables and Properties...

    "William Fields" <Bill_Fields@azb.uscourts.gov> wrote in message
    news:3929c0fe$1@news.devx.com...
    > I'm having a hard time with the following logic.
    >
    > SET DELETED = THISFORM.SomeProperty


    Use macro expansion for this, but you have to set a memvar equal to your
    property, first.

    > SET DELETED (THISFORM.SomeProperty)


    That's named expression syntax, which doens't work in this context.

    > SET DELETED &THISFORM.SomeProperty


    You can't macro expand a property. Specifically, since the first period
    after the macro & signifies the end of the macro expression, VFP looks for
    some string variable called "thisform" to substitute and prefix to
    "someproperty".

    > SET DELETED EVAL(THISFORM.SomeProperty)


    I don't understand the mechanism here of exactly what goes on, but if the
    property equals "ON", then doing EVAL on, the app will look for a memvar by
    the name of ON. In other words (I guess) EVAL must result in an expression,
    which the literal ON isn't.




  4. #4
    William Fields Guest

    Re: "SET" variables and Properties...

    Yes, from the other responses I've gathered that the only way to
    consistently use form properties to hold values for SET commands is to
    create a memvar first equal to the contents of the form property, then macro
    expand it.

    IE...

    LOCAL cSomeVar
    cSomeVar = THISFORM.SomeProperty
    SET DELETED &cSomeVar


    Thanks.

    --
    William Fields
    MCP - Microsoft Visual FoxPro
    US Bankruptcy Court
    Phoenix, AZ


    "Nancy Folsom [MS FoxPro MVP]" <nancy_folsom@hotmail.com> wrote in message
    news:3929de90@news.devx.com...
    > "William Fields" <Bill_Fields@azb.uscourts.gov> wrote in message
    > news:3929c0fe$1@news.devx.com...
    > > I'm having a hard time with the following logic.
    > >
    > > SET DELETED = THISFORM.SomeProperty

    >
    > Use macro expansion for this, but you have to set a memvar equal to your
    > property, first.
    >
    > > SET DELETED (THISFORM.SomeProperty)

    >
    > That's named expression syntax, which doens't work in this context.
    >
    > > SET DELETED &THISFORM.SomeProperty

    >
    > You can't macro expand a property. Specifically, since the first period
    > after the macro & signifies the end of the macro expression, VFP looks for
    > some string variable called "thisform" to substitute and prefix to
    > "someproperty".
    >
    > > SET DELETED EVAL(THISFORM.SomeProperty)

    >
    > I don't understand the mechanism here of exactly what goes on, but if the
    > property equals "ON", then doing EVAL on, the app will look for a memvar

    by
    > the name of ON. In other words (I guess) EVAL must result in an

    expression,
    > which the literal ON isn't.
    >
    >
    >




  5. #5
    Fred Taylor Guest

    Re: "SET" variables and Properties...

    About your only other option is to store some kind of conditional check and
    do it with an IF or DO CASE structure:

    IF condition="ON"
    SET DELETED ON
    ELSE
    SET DELETED OFF
    ENDIF

    - or -

    DO CASE
    CASE condition="ON"
    SET DELETED ON
    CASE condition="OFF"
    SET DELETED OFF
    OTHERWISE
    MESSAGEBOX("Unknown condition!")
    ENDCASE


    Fred

    William Fields wrote in message <392ab062@news.devx.com>...
    >Yes, from the other responses I've gathered that the only way to
    >consistently use form properties to hold values for SET commands is to
    >create a memvar first equal to the contents of the form property, then

    macro
    >expand it.
    >
    >IE...
    >
    >LOCAL cSomeVar
    >cSomeVar = THISFORM.SomeProperty
    >SET DELETED &cSomeVar
    >
    >
    >Thanks.
    >
    >--
    >William Fields
    >MCP - Microsoft Visual FoxPro
    >US Bankruptcy Court
    >Phoenix, AZ
    >
    >
    >"Nancy Folsom [MS FoxPro MVP]" <nancy_folsom@hotmail.com> wrote in message
    >news:3929de90@news.devx.com...
    >> "William Fields" <Bill_Fields@azb.uscourts.gov> wrote in message
    >> news:3929c0fe$1@news.devx.com...
    >> > I'm having a hard time with the following logic.
    >> >
    >> > SET DELETED = THISFORM.SomeProperty

    >>
    >> Use macro expansion for this, but you have to set a memvar equal to your
    >> property, first.
    >>
    >> > SET DELETED (THISFORM.SomeProperty)

    >>
    >> That's named expression syntax, which doens't work in this context.
    >>
    >> > SET DELETED &THISFORM.SomeProperty

    >>
    >> You can't macro expand a property. Specifically, since the first period
    >> after the macro & signifies the end of the macro expression, VFP looks

    for
    >> some string variable called "thisform" to substitute and prefix to
    >> "someproperty".
    >>
    >> > SET DELETED EVAL(THISFORM.SomeProperty)

    >>
    >> I don't understand the mechanism here of exactly what goes on, but if the
    >> property equals "ON", then doing EVAL on, the app will look for a memvar

    >by
    >> the name of ON. In other words (I guess) EVAL must result in an

    >expression,
    >> which the literal ON isn't.
    >>
    >>
    >>

    >
    >




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
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links