4 Replies Latest reply on Aug 9, 2013 12:30 PM by willrollo

    Setting field on multiple records

      Title

      Setting field on multiple records

      Post

           How do I set a few fields on several records that have been printed at once?

           Not sure where to put the set field step and if I need to use a loop...

           My script at the moment is this - confused parts in red:

            

             
      •           Perform Find [ Specified Find Requests: Find Records; Criteria: Customers::Mailmerge checkbox: “Y” ] [ Restore ]
      •      
      •           Go to Related Record [ From table: “Customers”; Using layout: “Preview (mail merge)” (Customers) ] [ Show only related records; Match found set ]
      •      
      •           Print Setup [ Orientation: Portrait; Paper size: 8.26" x 11.69" ] [ Restore; No dialog ]
      •      
      •           Enter Preview Mode [ Pause ]
      •      
      •           Print [ Records being browsed; All Pages; Orientation: Landscape; Paper size: 8.26" x 11.69" ] [ Restore: Kitchen Printer; No dialog ]
      •      
      •           Loop
      •      
      •           Go to Record/Request/Page [ First ]
      •      
      •           Set Field [ Customers::Follow_Up_Date_Due; Get(CurrentDate) ]
      •      
      •           Set Field [ Customers::Follow_Up_Date_Old; Customers::Follow_Up_Date_Recent ]
      •      
      •           Set Field [ Customers::Follow_Up_Date_Recent; Get(CurrentDate) ]
      •      
      •           Set Field [ Customers::Follow Up Actions Box; "Mail Merge Sent" ]
      •      
      •           Set Field [ Customers::Recent Contact; Customers::g_Lettername & " letter sent " & Get(CurrentDate) ]
      •      
      •           Go to Layout [ “ContactList” (Customers) ]
      •      
      •           Go to Record/Request/Page [ Next; Exit after last ]
      •      
      •           End Loop
      •      
      •           Enter Browse Mode
      •      
      •           #Set Reminder
      •      
      •           Show Custom Dialog [ Title: "Message"; Message: "Do you want to set a reminder to follow up this mail merge in two weeks? "; Default Button: “Yes”, Commit: “Yes”; Button 2: “No”, Commit: “No” ]
      •      
      •           If [ Get(LastMessageChoice) = 1 ]
      •      
      •           Go to Layout [ “ContactList” (Customers) ]
      •      
      •           Go to Record/Request/Page [ First ]
      •      
      •           Set Variable [ $note; Value:"Customer was sent " & Customers::g_Lettername & " merge letter, and needs following up. " ]
      •      
      •           Freeze Window
      •      
      •           Loop
      •      
      •           Set Field [ Customers::Follow Up required Check Box; "Y" ]
      •      
      •           Set Variable [ $ID_Contact; Value:Customers::ID_Contact_pk ]
      •      
      •           Set Variable [ $Address; Value:Customers::Address To ]
      •      
      •           Go to Layout [ “TO DO” (Customers_TO DO) ]
      •      
      •           New Record/Request
      •      
      •           Set Field [ Customers_TO DO::ID_Customers_fk; $ID_Contact ]
      •      
      •           Set Field [ Customers_TO DO::Name_To Do; $Address ]
      •      
      •           Set Field [ Customers_TO DO::Date Due; Get(CurrentDate)+14 ]
      •      
      •           Set Field [ Customers_TO DO::Text; $Note ]
      •      
      •           Commit Records/Requests [ Skip data entry validation; No dialog ]
      •      
      •           Go to Layout [ “ContactList” (Customers) ]
      •      
      •           Go to Record/Request/Page [ Next; Exit after last ]
      •      
      •           End Loop
      •      
      •           Else If [ Get(LastMessageChoice) = 2 ]
      •      
      •           Set Field [ Customers::Follow Up required Check Box; "" ]
      •      
      •           Exit Script [ ]
      •      
      •           End If
      •      
      •           Go to Layout [ “ContactList” (Customers) ]
      •      
      •           Show All Records
      •      
      •           Sort Records [ Keep records in sorted order; Specified Sort Order: Customers::Enquiry Date; descending ] [ Restore; No dialog ]
      •      
      •           Go to Record/Request/Page [ First ]

        • 1. Re: Setting field on multiple records
          philmodjunk

               Take a look at the Replace Field Contents script step. It can update a specified field for every record in your found set all in one step.

          • 2. Re: Setting field on multiple records

                 I tried that (I replaced my set fields (red) with replace field contents. I also removed the bits in blue, but it hasnt made any difference . Should these steps be positioned somewhere else..?

                 Thank you

                  

                   
            •           Loop
            •      
            •           Go to Record/Request/Page [ First ]
            •      
            •           Set Field [ Customers::Follow_Up_Date_Due; Get(CurrentDate) ]
            •      
            •           Set Field [ Customers::Follow_Up_Date_Old; Customers::Follow_Up_Date_Recent ]
            •      
            •           Set Field [ Customers::Follow_Up_Date_Recent; Get(CurrentDate) ]
            •      
            •           Set Field [ Customers::Follow Up Actions Box; "Mail Merge Sent" ]
            •      
            •           Set Field [ Customers::Recent Contact; Customers::g_Lettername & " letter sent " & Get(CurrentDate) ]
            •      
            •           Go to Layout [ “ContactList” (Customers) ]
            •      
            •           Go to Record/Request/Page [ Next; Exit after last ]
            •      
            •           End Loop
            • 3. Re: Setting field on multiple records
              philmodjunk

                   What I am suggesting would look like this:

                     
              •           Replace Field Contents [ no dialog ; Customers::Follow_Up_Date_Due; Get(CurrentDate) ]
              •      
              •           Replace Field Contents [ no dialog ; Customers::Follow_Up_Date_Old; Customers::Follow_Up_Date_Recent ]
              •      
              •           Replace Field Contents [ no dialog ; Customers::Follow_Up_Date_Recent; Get(CurrentDate) ]
              •      
              •           Replace Field Contents [ no dialog ;  Customers::Follow Up Actions Box; "Mail Merge Sent" ]
              •      
              •           Replace Field Contents [ no dialog ; Customers::Recent Contact; Customers::g_Lettername & " letter sent " & Get(CurrentDate) ]

                   No loops, no layout change, no go to record steps needed.

              • 4. Re: Setting field on multiple records

                     Thanks - being in preview mode didnt help!