AnsweredAssumed Answered

Inconsistencies with inserting an image via script

Question asked by HB on May 9, 2017
Latest reply on May 9, 2017 by HB

I am having mixed results with this portion of a script that is to insert an image into a record from a file whose name is prefixed by the WO_Number of the record.  Sometimes the image gets inserted but the odd time it doesn't. This has happened with different file/records on different days. The P drive source is a Local folder that is shared & has been mapped as P on this computer where I am finding some inconsistencies, and I would prefer to keep it that way as in the future the script could be run from another computer on the network.

 

Any red flags here on my method? I havn't really looked at error trap routines (ever) but I am guessing that would be my next option????

 

Also - I am thinking of moving the 'Go to Field [ Images::Picture ]' step before the loop - that shouldn't be a problem should it?

 

Thanks in advance.

 

  • Show All Records
  • Freeze Window
  • Sort Records [ Keep records in sorted order; Specified Sort Order: Wrk_Ordr::WO Number; descending ] [ Restore; No dialog ]
  • Go to Record/Request/Page [ First ]
  • #Insert Image File Refs
  • Loop
  • Set Error Capture [ On ]
  • Go to Field [ Images::Picture ]
  • Set Variable [ $fn; Value:"imagewin:/P:/Gallery/Wall600/" & Wrk_Ordr::WO Number & ".600.jpg" ]
  • Insert Picture [ “$fn” ] [ Reference ]
  • If [ $HighestPicUpdated ="" ]
  • If [ Get ( LastError ) = 0 ]
  • Set Variable [ $HighestPicUpdated; Value:Wrk_Ordr::WO Number ]
  • End If
  • End If
  • Set Error Capture [ Off ]
  • If [ Wrk_Ordr::Work Progress = "received" ]
  • Set Field [ Wrk_Ordr::BR_ImageChecked; 1 ]
  • End If
  • Go to Record/Request/Page [ Next; Exit after last ]
  • End Loop

Outcomes