Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics SL forum
Unanswered

TI Button for Resource Assignment Screen

Posted on by 1,035

I have the following Control Macro

 

'$include: "bsl.dh" 'PARAS Control Macro Sub ProcessImportLine( LevelNumber%, Retval% )   select Case LevelNumber     case TI_Start

      call AliasConstant( "Level0", "ProjTask" )

      call AliasConstant( "Level1", "TaskAssign" )

    case 0 ' 0 of 1  

    'Level 0 if of Type N       ' cProject is a key field for level 0       ' Field mask is WWWWWWWWWWWWWWW       ' NOTE  -- This field is a required field       serr = SetObjectValue( "cProject", ImportField(1) )

      ' cTask is a key field for level 0       ' Field mask is 999       ' NOTE  -- This field is a required field       serr = SetObjectValue( "cTask", ImportField(2) )

'Currently Disabled cproject_desc

'Currently Disabled cpjt_entity_desc

    case 1 ' 1 of 1

    'Level 1 if of Type D       ' cresemployee is a key field for level 1       ' Field mask is UUUUUUUUUU       ' NOTE  -- This field is a required field       serr = SetObjectValue( "cresemployee", ImportField(1) )

      ' cSubtask is a key field for level 1       ' Field mask is XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       ' serr = SetObjectValue( "cSubtask", ImportField(2) )

'Currently Disabled cresname

      ' cressdate is a Date Field Type       ' NOTE  -- This field is a required field       ' serr = SetObjectValue( "cressdate", ImportField(3) )

      ' cresedate is a Date Field Type       ' serr = SetObjectValue( "cresedate", ImportField(4) )

'Currently Disabled cresActuals

      serr = SetObjectValue( "cresbudhrs", ImportField(2) )

      serr = SetObjectValue( "cresbudamt", ImportField(3) )

      ' Field mask is XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       ' serr = SetObjectValue( "cComment", ImportField(7) )

    case TI_Finish

      serr = SetObjectValue( "cmdUpdLabBud", "PRESS" )

  End Select

End Sub ' The following shows the correct syntax to '  PRESS a button ' These object names are specific to this screen. '      Button object name cmdUpdLabBud, Caption &Update Budget '      serr = SetObjectValue( "cmdUpdLabBud", "PRESS" )

'      Button object name cmdAssignInq, Caption &Assignment Inquiry ... '      serr = SetObjectValue( "cmdAssignInq", "PRESS" )

 

If I have a file with one Project Task level and multiple Resource lines the button presses and the Budget gets updated. How do I scales this up to multiple Project Task lines. Where the button press command is will only press the button at the end of the import process. I cannot work out where the code line should be placed to press the button when the project task changes

  • KenF58 Profile Picture
    KenF58 1,035 on at
    RE: TI Button for Resource Assignment Screen

    Further testing has revealed that my solution was a mirage <deep sigh>

    The problem is with the placement of the Button Press

    The code in case TI_Finish works, but that only updates the last project task in the import file

    If the code is placed after End Select you get:

    'PC Message Number 1503: You must save your changes in the grid before Updating Budgets.

    I tried adding in:

    Call SetLevelChg(LEVEL1, UPDATED)

    Call Edit_Save

    No Joy it seems like the Edit_Save does not work in TI

    Then I found the Sub ButtonLevelChange in sample six in the TI Manual

    Sub ButtonLevelChange

          Dim LevelPair$

          LevelPair = trim$(str$(LevelFrom)) + "-" + trim$(str$(LevelTo))

          Select Case LevelPair

                 case "0-1"

                        serr = SetObjectValue ("class1","PRESS")

                        serr = SetObjectValue ("command1","PRESS")

          End Select

    End Sub

    Perfect I thought just change case to "1-0" and put in the  button code...

    As experienced users of SL help files will know, none of the samples given appear to have actually been tested

    When TI tries to compile the control file it barfs because Levelfrom does not have a DIM statement!

    Well no it does not, but then you would expect it to be passed to the sub by TI

    So I tried:

    Sub ButtonLevelChange(LevelFrom%, LevelTo%, Retval%)

          Dim LevelPair$

          LevelPair = trim$(str$(LevelFrom)) + "-" + trim$(str$(LevelTo))

          Select Case LevelPair

                 case "1-0"

                 call edit_save

                 serr = SetObjectValue( "cmdUpdLabBud", "PRESS" )

          End Select

    End Sub

    OK no compile error, but the button did not get pressed

    So back to square one...

    If you have managed to read all of this can you help?

  • KenF58 Profile Picture
    KenF58 1,035 on at
    RE: TI Button for Resource Assignment Screen

    I added the following code

    Sub ProcessImportLine( LevelNumber%, Retval% )

    If LevelNumber = 0 and serr12 = 1 then serr = SetObjectValue( "cmdUpdLabBud", "PRESS" )

    .

    .

    .

    .

    case TI_Finish

    serr = SetObjectValue( "cmdUpdLabBud", "PRESS" )

     End Select

    serr12 = LevelNumber

    End Sub

    This seems to work ok.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,554 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,588 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans