Announcement

Collapse
No announcement yet.

var value getting clobbered

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    var value getting clobbered



    Maybe there's something wrong with your keycode_write( ... ) function.
    The rest of it looks OK to me.

    Scott Shepard wrote:
    > Hello ,
    >
    > So here is the code that works in uncompiled but not when it is
    > compiled. Here's my intention, If g.ids_entry is Null, which it is
    > first time through, I check to see if it's in the key code file. If
    > yes, set the flag to 1. If not, use an "input" prompt. Second time
    > thru, If the
    > keycode didn't exist in the file but g.ids_entry had a value, then
    > write the key code to the file. (other functions check the validity
    > later on).
    >
    > The second time through (automatic when "update" button is clicked), the file should get written because the
    > g.ids_entry should have a value (it entered into the input box) when
    > it didn't exist before.
    >
    > The MvEval statement are there only for debugging, and encodeentities
    > hasn't made a difference (with or without).
    >
    > So why might it be that in second time thru, g.ids_entry is empty in
    > the compiled, but not uncompiled?
    >
    > <MvEVAL EXPR = "{ g.ids_entry $ '
    ' }">

    > <MvIF EXPR="{ NOT g.ids_entry }">
    > <MvASSIGN NAME = "g.ids_entry" VALUE = "{ read_keycodefile() }">
    > <MvEVAL EXPR = "{ g.ids_entry $ '
    ' }">

    > <MvIF EXPR="{ g.ids_entry }">
    > <MvASSIGN NAME = "g.ids_keycode_exist" VALUE = "{ 1 }">
    > <MvEVAL EXPR = "{ g.ids_entry $ '
    ' }">

    > </MvIf>
    > </MvIf>
    > <MvIF EXPR="{ NOT g.ids_entry }">
    > Enter your keycode: 

    > <input type="text" name="g.ids_entry" size="50">

    > <INPUT TYPE = "hidden" NAME = "g.ids_entry" VALUE = "{ encodeentities(g.ids_entry) }">
    > <MvElse>
    > <MvIF EXPR="{ NOT g.ids_keycode_exist }">
    > <MvASSIGN NAME = "g.ids_keycode_exist" VALUE = "{ keycode_write( g.ids_entry ) }">
    > </MvIf>
    > </MvIf>
    >
    >
    > <MvASSIGN NAME = "g.ids_keycode_exist" VALUE = "{ read_keycodefile() }">
    > <MvEVAL EXPR = "{ g.ids_keycode_exist $ '
    ' }">
    >
    > <MvIF EXPR = "{ (g.ids_keycode_exist) }">
    > **** Run the code that configs the operation of module *****
    >
    > TIA


    #2
    var value getting clobbered



    Hello ,

    So here is the code that works in uncompiled but not when it is
    compiled. Here's my intention, If g.ids_entry is Null, which it is
    first time through, I check to see if it's in the key code file. If
    yes, set the flag to 1. If not, use an "input" prompt. Second time
    thru, If the
    keycode didn't exist in the file but g.ids_entry had a value, then
    write the key code to the file. (other functions check the validity
    later on).

    The second time through (automatic when "update" button is clicked), the file should get written because the
    g.ids_entry should have a value (it entered into the input box) when
    it didn't exist before.

    The MvEval statement are there only for debugging, and encodeentities
    hasn't made a difference (with or without).

    So why might it be that in second time thru, g.ids_entry is empty in
    the compiled, but not uncompiled?

    <MvEVAL EXPR = "{ g.ids_entry $ '
    ' }">

    <MvIF EXPR="{ NOT g.ids_entry }">
    <MvASSIGN NAME = "g.ids_entry" VALUE = "{ read_keycodefile() }">
    <MvEVAL EXPR = "{ g.ids_entry $ '
    ' }">

    <MvIF EXPR="{ g.ids_entry }">
    <MvASSIGN NAME = "g.ids_keycode_exist" VALUE = "{ 1 }">
    <MvEVAL EXPR = "{ g.ids_entry $ '
    ' }">

    </MvIf>
    </MvIf>
    <MvIF EXPR="{ NOT g.ids_entry }">
    Enter your keycode: 

    <input type="text" name="g.ids_entry" size="50">

    <INPUT TYPE = "hidden" NAME = "g.ids_entry" VALUE = "{ encodeentities(g.ids_entry) }">
    <MvElse>
    <MvIF EXPR="{ NOT g.ids_keycode_exist }">
    <MvASSIGN NAME = "g.ids_keycode_exist" VALUE = "{ keycode_write( g.ids_entry ) }">
    </MvIf>
    </MvIf>


    <MvASSIGN NAME = "g.ids_keycode_exist" VALUE = "{ read_keycodefile() }">
    <MvEVAL EXPR = "{ g.ids_keycode_exist $ '
    ' }">

    <MvIF EXPR = "{ (g.ids_keycode_exist) }">
    **** Run the code that configs the operation of module *****

    TIA
    --
    Best regards,
    Scott
    mailto:[email protected]



    Comment


      #3
      Re[2]: var value getting clobbered



      Thanks Scott.

      Here are the read and write functions.

      <MvFUNCTION NAME = "keycode_write" PARAMETERS = "ids_key" STANDARDOUTPUTLEVEL = "">
      <MvASSIGN NAME = "l.directory" VALUE = "{ g.MerchantPath $ padl( Stores.d.id, 8, '0' ) $ '/custompay/' }">
      <MvEVAL EXPR = "{ 'KeyCode: ' $ l.ids_key $ '
      ' }">
      <MvASSIGN NAME = "l.ids_key" VALUE = "{ ltrim(rtrim(l.ids_key)) }">
      <MvIF EXPR = "{ l.ids_key }">
      <MvEVAL EXPR = "{ 'Key: ' $ l.ids_key $ '
      ' }">
      <MvEXPORT
      FILE="{l.directory $'keycodefile'$'.dat'}"
      FIELDS="l.ids_key"
      DELIMITER="">
      </MvIf>
      <MvFUNCTIONRETURN VALUE = "{ l.ids_key }">
      </MvFUNCTION>

      <MvFUNCTION NAME = "read_keycodefile" STANDARDOUTPUTLEVEL = "">
      <MvASSIGN NAME = "l.directory" VALUE = "{ g.MerchantPath $ padl( Stores.d.id, 8, '0' ) $ '/mymoduledirname/' }">
      <MvASSIGN NAME = "l.thekeycode" VALUE = "">
      <MvIF EXPR = "{ fexists( l.directory $'keycodefile.dat' ) }">
      <MvImport File = "{l.directory $'keycodefile'$'.dat'}"
      Fields = "l.thekeycode"
      Delimiter = "">
      </MvImport>
      </MvIf>
      <MvASSIGN NAME = "l.thekeycode" VALUE = "{ ltrim(rtrim(l.thekeycode)) }">
      <MvFUNCTIONRETURN VALUE = "{ l.thekeycode }">
      </MvFUNCTION>

      Tuesday, October 26, 2004, 12:45:07 PM, you wrote:

      SR> Maybe there's something wrong with your keycode_write( ... ) function.
      SR> The rest of it looks OK to me.

      SR> Scott Shepard wrote:
      >> Hello ,
      >>
      >> So here is the code that works in uncompiled but not when it is
      >> compiled. Here's my intention, If g.ids_entry is Null, which it is
      >> first time through, I check to see if it's in the key code file. If
      >> yes, set the flag to 1. If not, use an "input" prompt. Second time
      >> thru, If the
      >> keycode didn't exist in the file but g.ids_entry had a value, then
      >> write the key code to the file. (other functions check the validity
      >> later on).
      >>
      >> The second time through (automatic when "update" button is clicked), the file should get written because the
      >> g.ids_entry should have a value (it entered into the input box) when
      >> it didn't exist before.
      >>
      >> The MvEval statement are there only for debugging, and encodeentities
      >> hasn't made a difference (with or without).
      >>
      >> So why might it be that in second time thru, g.ids_entry is empty in
      >> the compiled, but not uncompiled?
      >>
      >> <MvEVAL EXPR = "{ g.ids_entry $ '
      ' }">

      >> <MvIF EXPR="{ NOT g.ids_entry }">
      >> <MvASSIGN NAME = "g.ids_entry" VALUE = "{ read_keycodefile() }">
      >> <MvEVAL EXPR = "{ g.ids_entry $ '
      ' }">

      >> <MvIF EXPR="{ g.ids_entry }">
      >> <MvASSIGN NAME = "g.ids_keycode_exist" VALUE = "{ 1 }">
      >> <MvEVAL EXPR = "{ g.ids_entry $ '
      ' }">

      >> </MvIf>
      >> </MvIf>
      >> <MvIF EXPR="{ NOT g.ids_entry }">
      >> Enter your keycode: 

      >> <input type="text" name="g.ids_entry" size="50">

      >> <INPUT TYPE = "hidden" NAME = "g.ids_entry" VALUE = "{ encodeentities(g.ids_entry) }">
      >> <MvElse>
      >> <MvIF EXPR="{ NOT g.ids_keycode_exist }">
      >> <MvASSIGN NAME = "g.ids_keycode_exist" VALUE = "{ keycode_write( g.ids_entry ) }">
      >> </MvIf>
      >> </MvIf>
      >>
      >>
      >> <MvASSIGN NAME = "g.ids_keycode_exist" VALUE = "{ read_keycodefile() }">
      >> <MvEVAL EXPR = "{ g.ids_keycode_exist $ '
      ' }">
      >>
      >> <MvIF EXPR = "{ (g.ids_keycode_exist) }">
      >> **** Run the code that configs the operation of module *****
      >>
      >> TIA



      --
      Best regards,
      Scott
      mailto:[email protected]



      Comment


        #4
        Re[3]: var value getting clobbered



        Doesn't make much sense to me. I've played around a little more. I
        loaded the g.ids_entry var with a fixed value, bypassing the INPUT
        TEXT box. The routing runs perfectly in compiled version also.

        My conclusion is still that g.ids_entry var/value goes away when
        update is clicked. Doesn't make any sense. Simple code/logic, so maybe
        something I'm missing that is simple but a little esoteric? Obviously
        directly related to environment with compiled MM/Mia/Empressa.
        Something that a lowly developer would miss in some circumstances.

        TIA
        Scott
        IDS

        Tuesday, October 26, 2004, 2:02:09 PM, you wrote:

        SS> Thanks Scott.

        SS> Here are the read and write functions.

        SS> <MvFUNCTION NAME = "keycode_write" PARAMETERS = "ids_key" STANDARDOUTPUTLEVEL = "">
        SS> <MvASSIGN NAME = "l.directory" VALUE = "{ g.MerchantPath $ padl( Stores.d.id, 8, '0' ) $ '/custompay/' }">
        SS> <MvEVAL EXPR = "{ 'KeyCode: ' $ l.ids_key $ '
        ' }">
        SS> <MvASSIGN NAME = "l.ids_key" VALUE = "{ ltrim(rtrim(l.ids_key)) }">
        SS> <MvIF EXPR = "{ l.ids_key }">
        SS> <MvEVAL EXPR = "{ 'Key: ' $ l.ids_key $ '
        ' }">
        SS> <MvEXPORT
        SS> FILE="{l.directory $'keycodefile'$'.dat'}"
        SS> FIELDS="l.ids_key"
        SS> DELIMITER="">
        SS> </MvIf>
        SS> <MvFUNCTIONRETURN VALUE = "{ l.ids_key }">
        SS> </MvFUNCTION>

        SS> <MvFUNCTION NAME = "read_keycodefile" STANDARDOUTPUTLEVEL = "">
        SS> <MvASSIGN NAME = "l.directory" VALUE = "{ g.MerchantPath $ padl( Stores.d.id, 8, '0' ) $ '/mymoduledirname/' }">
        SS> <MvASSIGN NAME = "l.thekeycode" VALUE = "">
        SS> <MvIF EXPR = "{ fexists( l.directory $'keycodefile.dat' ) }">
        SS> <MvImport File = "{l.directory $'keycodefile'$'.dat'}"
        SS> Fields = "l.thekeycode"
        SS> Delimiter = "">
        SS> </MvImport>
        SS> </MvIf>
        SS> <MvASSIGN NAME = "l.thekeycode" VALUE = "{ ltrim(rtrim(l.thekeycode)) }">
        SS> <MvFUNCTIONRETURN VALUE = "{ l.thekeycode }">
        SS> </MvFUNCTION>

        SS> Tuesday, October 26, 2004, 12:45:07 PM, you wrote:

        SR>> Maybe there's something wrong with your keycode_write( ... ) function.
        SR>> The rest of it looks OK to me.

        SR>> Scott Shepard wrote:
        >>> Hello ,
        >>>
        >>> So here is the code that works in uncompiled but not when it is
        >>> compiled. Here's my intention, If g.ids_entry is Null, which it is
        >>> first time through, I check to see if it's in the key code file. If
        >>> yes, set the flag to 1. If not, use an "input" prompt. Second time
        >>> thru, If the
        >>> keycode didn't exist in the file but g.ids_entry had a value, then
        >>> write the key code to the file. (other functions check the validity
        >>> later on).
        >>>
        >>> The second time through (automatic when "update" button is clicked), the file should get written because the
        >>> g.ids_entry should have a value (it entered into the input box) when
        >>> it didn't exist before.
        >>>
        >>> The MvEval statement are there only for debugging, and encodeentities
        >>> hasn't made a difference (with or without).
        >>>
        >>> So why might it be that in second time thru, g.ids_entry is empty in
        >>> the compiled, but not uncompiled?
        >>>
        >>> <MvEVAL EXPR = "{ g.ids_entry $ '
        ' }">

        >>> <MvIF EXPR="{ NOT g.ids_entry }">
        >>> <MvASSIGN NAME = "g.ids_entry" VALUE = "{ read_keycodefile() }">
        >>> <MvEVAL EXPR = "{ g.ids_entry $ '
        ' }">

        >>> <MvIF EXPR="{ g.ids_entry }">
        >>> <MvASSIGN NAME = "g.ids_keycode_exist" VALUE = "{ 1 }">
        >>> <MvEVAL EXPR = "{ g.ids_entry $ '
        ' }">

        >>> </MvIf>
        >>> </MvIf>
        >>> <MvIF EXPR="{ NOT g.ids_entry }">
        >>> Enter your keycode: 

        >>> <input type="text" name="g.ids_entry" size="50">

        >>> <INPUT TYPE = "hidden" NAME = "g.ids_entry" VALUE = "{ encodeentities(g.ids_entry) }">
        >>> <MvElse>
        >>> <MvIF EXPR="{ NOT g.ids_keycode_exist }">
        >>> <MvASSIGN NAME = "g.ids_keycode_exist" VALUE = "{ keycode_write( g.ids_entry ) }">
        >>> </MvIf>
        >>> </MvIf>
        >>>
        >>>
        >>> <MvASSIGN NAME = "g.ids_keycode_exist" VALUE = "{ read_keycodefile() }">
        >>> <MvEVAL EXPR = "{ g.ids_keycode_exist $ '
        ' }">
        >>>
        >>> <MvIF EXPR = "{ (g.ids_keycode_exist) }">
        >>> **** Run the code that configs the operation of module *****
        >>>
        >>> TIA






        --
        Best regards,
        Scott
        mailto:[email protected]



        Comment

        Working...
        X