1 2 3 Previous Next 30 Replies Latest reply on Aug 12, 2011 12:54 PM by mgores

    container export

    mgores

      Title

      container export

      Post

      I have a script that exports the contents of a container to a folder on the server (defined from a variable).  The script works on all of the computers I have tested it on, but fails when using an iPad.  Currently the script is run by clicking a button next to the container.  I am guessing that FM Go on the iPad is trying to run the script and since it can't see the network won't export the file.

      Is there a way to trigger the script to run on the server/host computer rather than having FM Go run it?

        • 1. Re: container export
          philmodjunk

          Hope you have also posted this in the FM GO Forum....

          It's theoretically possible. You could set a value in a field via the iPad and a scheduled script could kick in and check for that value and export the data if the value is set... That would require a schedule that runs this script very frequently and even then, the system wouldn't be very responsive to you so I hope the FM GO folks have a better solution...

          • 2. Re: container export
            mgores

            I did post in the GO section as well.  There isn't a lot of traffic there so thought I might get a quicker response here.  I tried setting an on timer script to run the export script with the parameter to check RightValue (Photo::user; 4; "iPad").  It does seem to kind of work, I set it for 20 seconds.  Looks like I need to add a field to flag it as having been exported, so that once it's been done it doesn't try to export that one again. 

            Right now it keeps exporting the same file every 20 seconds.Smile

            • 3. Re: container export
              mgores

              Added a photo::exported field and a step to set that field to Y when it is exported.  Then added steps at the beginning of script to do a find for photo::exported "="(is empty)

              Now is there a way to suppress the "No records match" error message and have the time script keep going?

              • 4. Re: container export
                philmodjunk

                Set Error Capture (on)

                • 5. Re: container export
                  mgores

                  I tried that, right after the perform find step, and still get the error message.

                  • 6. Re: container export
                    philmodjunk

                    Put it just before the perform find step, not after.

                    • 7. Re: container export
                      mgores

                      ah, thats better.  It does slow down the file though. 

                      Might it speed things up a little if I put an exit script step close to the beginning?

                      • 8. Re: container export
                        philmodjunk

                        I have no idea nor can I think of a reason why Set Error capture would slow it down. (My crystal ball isn't letting me see the actual script you have set up here. Wink )

                        • 9. Re: container export
                          rjlevesque

                          Dangit Phil! Did you forget to pay your Crystal ball bill again! I keep telling you to pay that sucker every month!  hehehe

                          • 10. Re: container export
                            rjlevesque

                            Mark Gores, slow down just a little and figure out what each script step does and it will all make more sense to you.

                            Example: Might it speed things up a little if I put an exit script step close to the beginning?

                            An EXIT script step is going to do just that, exit the script, then nothing else in the script will run past the begining EXIT step you placed. Best to learn what each script step does rather than grab snippets and throw them in willy-nilly. Not picking on you, just learn what each does as you go, why you should use it, and then everything will make sense and solution development gets easier.

                            • 11. Re: container export
                              mgores

                              Sorry I wasn't more clear.  I didn't mean that the error capture was slowing it down, but some of the other steps I had in there, some set variable steps and a If(isEmpty) check on the container.  Was just thinking putting in a step to kick it out if there were no records found might speed it up a little.

                              Phil, here is your crystal ball:

                              Go to Layout [ “photolist” (Photos) ]
                              Set Error Capture [ On ]
                              Perform Find [ Specified Find Requests: Find Records; Criteria: Photos::exported: “=” ]
                              [ Restore ]
                              Go to Record/Request/Page
                              [ First ]
                              If [ IsEmpty ( Photos::Photo) ]
                              Show All Records
                              Go to Layout [ original layout ]
                              Exit Script [ ]
                              End If
                              Set Variable [ $filename; Value:Photos::Samplenumber & "-" & Photos::pictype& "-" & Photos::Mag ]
                              Set Variable [ $filepath; Value:"DPA/"&Photopage::jobnumber & "/" ]
                              Set Variable [ $newname; Value:Photopage::jobnumber& "-" & $filename & ".jpg" ]
                              If [ Photos::exported = "Y" ]
                              Exit Script [ ]
                              End If
                              Export Field Contents [ Photos::Photo; “filemac:/ServerX/$filepath/$newname” ]
                              Insert Picture [ “imagemac:/ServerX/$filepath/$newname” ]
                              [ Reference ]
                              Set Field [ Photos::exported; "Y" ]
                              Go to Layout [ original layout ]
                              Show All Records

                              • 12. Re: container export
                                philmodjunk

                                Don't know if it's any faster, but you could do this:

                                Go to Layout [ “photolist” (Photos) ]
                                Set Error Capture [ On ]
                                Perform Find [ Specified Find Requests: Find Records; Criteria: Photos::exported: “=” ][ Restore ]
                                If [ Get ( FoundCount ) ]
                                       Loop
                                               Set Variable [ $filename; Value:Photos::Samplenumber & "-" & Photos::pictype& "-" & Photos::Mag ]
                                               Set Variable [ $filepath; Value:"DPA/"&Photopage::jobnumber & "/" ]
                                               Set Variable [ $newname; Value:Photopage::jobnumber& "-" & $filename & ".jpg" ]
                                               Export Field Contents [ Photos::Photo; “filemac:/ServerX/$filepath/$newname” ]
                                               Insert Picture [ “imagemac:/ServerX/$filepath/$newname” ][ Reference ]
                                               Set Field [ Photos::exported; "Y" ]
                                               Go to record/request/page [next ; exit after last]
                                       end loop
                                End If
                                Go to Layout [ original layout ]
                                Show All Records

                                • 13. Re: container export
                                  mgores

                                  That does seem like a much tighter script.  Will try that out.  Think I can combine the filename and newname variables too (was left over from a script in another application where I needed each).  The only issue now is that every 20 seconds it kicks me out of the field I am entering data in, but that only happens on my computer which is hosting the file until I get ready to "go live".

                                  • 14. Re: container export
                                    philmodjunk

                                    And if you need to, the script could record the field name of the current field in a variable, then return you there after it's performed. Giving each such field an object name matching the field name would make this easier as you can then use go To object to put the cursor back into the correct field.

                                    1 2 3 Previous Next