AnsweredAssumed Answered

'Set Variable' and 'Set Field' does not work (Copy/Paste does)

Question asked by carmean on Mar 3, 2016
Latest reply on Mar 3, 2016 by siplus

In the script below when I try to 'Set Variable' instead of copying a selected field and then 'Set Field' with that variable instead of Pasting I get output only from the first record found.  I don't think there should be any difference between the two (the script is not trying to paste anything elsewhere).  The purpose of the script is to create a text file with list of courses and the people assigned BUs to them.  The script as it is shown works (because I enabled copy/paste and disabled the Set Variable/Field steps).

 

*** Problem & Solution Found ***

The Paste step does not 'Select entire contents' while the 'Set Field' replaced the entire contents of the  field with just the variable.

I need to make the set field calculate the current field plus the Variable, not just the Variable.  Here is correct entry for set field:

Set Field [ rankings one record per course::applicants; rankings one record per course::applicants & " " & $rankingBUcalc ]

 

Thank you 'siplus' for helping me find the problem.  You are right- I am getting rid of the copy & paste in my scripts so I don't overwrite people's clipboard.

 

The (apparent) problematic portion of the script is here:

Loop

// Set Variable [ $rankingBUcalc; Value:RANKINGS::Name BU calc ]

Copy [ RANKINGS::Name BU calc ] [ Select ]

Go to Layout [ “rankings one record per course” (rankings one record per course) ]

// Set Field [ rankings one record per course::applicants; $rankingBUcalc ]
Paste [ rankings one record per course::applicants ]
Go to Layout [ “List of applications for data entry by course” (RANKINGS) ]

Select Window [ Current Window ]
Insert Text [ RANKINGS::exported to final TA email; “exported” ]

[ Select ]

Insert Calculated Result [ RANKINGS::exported processing to finalTA email; RANKINGS::Course Semester calc ] [ Select ]

Go to Record/Request/Page

[ Next; Exit after last ]

End Loop

 

The entire script is here (with the problematic loop in Blue):

Set Error Capture [ On ]

Go to Layout [ “rankings one record per course” (rankings one record per course) ]

Show All Records

Delete All Records

            [ No dialog ]

Go to Layout [ “List of applications for data entry by course” (RANKINGS) ]

Perform Script [ “Clear previous exported marker” ]

Perform Find [ Specified Find Requests: Find Records; Criteria: RANKINGS::BU: “*” ]

            [ Restore ]

      If [ Get(LastError) <> 0 ]

            Show All Records

            Go to Field [ RANKINGS::BU ]
           
Refresh Window
            Show Custom Dialog
[ Message: "Please enter BUs for the TA you want."; Buttons: “Cancel” ]

            Halt Script

      End If

Loop

      Perform Find [ Specified Find Requests: Find Records; Criteria: RANKINGS::BU: “*”

                Omit Records; Criteria: RANKINGS::exported to final TA email: “*” ]
                [ Restore ]

      If [ Get(LastError) <> 0 ]
           
Go to Layout [ “rankings one record per course” (rankings one record per course) ]
           
Show All Records
            Set Variable
[ $filepathTAtxt; Value:"filemac:" & Get ( DesktopPath ) & "TA/" & "finalTA" & $$NextSemester & ".txt" ]

            Set Variable [ $filepathWinTAtxt; Value:"filewin:" & Get ( DesktopPath ) & "TA\\" & "finalTA" & $$NextSemester & ".txt" ]

            Export Records [ File Name: “$filepathTAtxt” OR “$filepathWinTAtxt”; Character Set: “Macintosh”; Field Order: rankings one record per course::course

                        rankings one record per course::applicants ]

                        [ No dialog ]

            Go to Layout [ original layout ]
            Perform Find [ Specified Find Requests: Find Records; Criteria: RANKINGS::BU: “*” ]

                        [ Restore ]

            Sort Records [ Specified Sort Order: RANKINGS::Course; ascending

                        TA applicant preferences::Name Full; ascending ]
                        [ Restore; No dialog ]

            Go to Record/Request/Page

                        [ First ]
           
Show Custom Dialog [ Title: "List Done!"; Message: "Go to the TA folder on your desktop and open finalTA.txt"; Buttons: “OK” ]

            Halt Script

      End If

      Sort Records [ Specified Sort Order: RANKINGS::Course; ascending

            TA applicant preferences::Name Full; ascending ]
            [ Restore; No dialog ]      

      Go to Record/Request/Page

            [ First ]
     
Set Variable [ $rankingcourse; Value:RANKINGS::Course ]
     
Go to Layout [ “rankings one record per course” (rankings one record per course) ]

      New Record/Request
      Set Field
[ rankings one record per course::course; $rankingcourse ]
     
Go to Layout [ “List of applications for data entry by course” (RANKINGS) ]
     
Set Variable [ $rankingExactcourse; Value:RANKINGS::Course for exact find calc ]

      Modify Last Find
      Set Field
[ RANKINGS::Course; $rankingExactcourse ]
     
Perform Find [ ]

      Sort Records [ Specified Sort Order: RANKINGS::Course; ascending

            TA applicant preferences::Name Full; ascending ]
            [ Restore; No dialog ]

      Go to Record/Request/Page

            [ First ]

    Loop

            // Set Variable [ $rankingBUcalc; Value:RANKINGS::Name BU calc ]

            Copy [ RANKINGS::Name BU calc ] [ Select ]

            Go to Layout [ “rankings one record per course” (rankings one record per course) ]

            // Set Field [ rankings one record per course::applicants; $rankingBUcalc ]
            Paste [ rankings one record per course::applicants ]
           
Go to Layout [ “List of applications for data entry by course” (RANKINGS) ]

            Select Window [ Current Window ]
           
Insert Text [ RANKINGS::exported to final TA email; “exported” ]

                        [ Select ]

            Insert Calculated Result [ RANKINGS::exported processing to finalTA email; RANKINGS::Course Semester calc ]

                        [ Select ]

            Go to Record/Request/Page

                        [ Next; Exit after last ]

      End Loop

End Loop

 

   

 

 

 

 

Message was edited by: David Carmean after the troubleshooting suggestion of siplus.  The correct solution is given (since looping was only indirectly part of the problem I removed that from the subject.

Outcomes