SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 3 of 3
  1. #1
    Member
    Join Date
    Jun 2007
    Location
    Europe, France, Lille
    Posts
    123
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    WorkFlow - Public Declaration

    Hi all,
    Can someone tell me if it is possible or not to have a public variable declared in exemple in Project_DefaultRes?

    <font class="small">Code:</font><hr /><pre>
    Function Project_DefaultRes
    Dim oldvalue
    End Function

    Sub TestLab_TestSetTests_FieldCanChange(FieldName, NewValue)
    select case FieldName
    case "TC_USER_20"
    if CInt(NewValue) = CInt(TestSetTest_Fields("TC_USER_20").Value) then
    {....}
    else
    oldvalue=NewValue
    End If
    End Sub
    </pre><hr />

    In TestLab_TestSetTests_FieldCanChange, the case 'else' works at first enty in sub. But when the event appears the second time (newvalue has replace old value in field), the variable oldvalue is ="".
    So, In conclusion, oldvalue is not a global (public) variable.
    What is the workaround ?
    Thanks.
    Arnaud
    idomotique
    we make your dream

  2. #2
    Advanced Member cgrzelka's Avatar
    Join Date
    Feb 2005
    Location
    Bordeaux, France
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: WorkFlow - Public Declaration

    Variable scope problem : if you "declare" oldvalue in the Project_DefaultRes function, it's not visible outside of that function.

    As you did not use the "Option Explicit" statement in the workflow module for the TestLab, there is no error on the statement "oldvalue = NewValue" : that "oldvalue" is automatically declared as local to the TestLab_TestSetTests_Field sub.

    Move the Dim oldValue statement outside of the Project_DefaultRes function (outside of all functions / subs by the way) : this will make it a "global" variable that you can access from all functions/subs of the workflow, unless you Dim the same variable inside a function/sub.

    Also, use Option Explicit at the beginning of each workflow module, use On Error Resume Next at the beginning of each function/sub and "If Err &lt;&gt; 0 Then MsgBox Err.Description" and "On Error GoTo 0" at the end of each function/sub.

  3. #3
    Member
    Join Date
    Jun 2007
    Location
    Europe, France, Lille
    Posts
    123
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: WorkFlow - Public Declaration

    That s nice. Thanks a lot Christian !
    Arnaud
    idomotique
    we make your dream

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin 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:54 PM.

Copyright BetaSoft Inc.