[FileMaker Pro 12] Script is traag

Pagina: 1
Acties:

Acties:
  • 0 Henk 'm!

  • Mastha-Hacker
  • Registratie: Mei 2009
  • Laatst online: 02-12-2024
Hallo,

Ik heb voor Filemaker een script geschreven om door middel van een plug-in alle records naar het adres boek te schrijven. Dit gaat alleen heel erg traag. De snelheid ligt momenteel op de 1 record per 2 seconden. Ik moet ca. 6000 records weg schrijven. Weet iemand waarom mijn script zo langzaam is? Of zal het nooit sneller kunnen.

C++:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Froodware: Insert all contacts in Address Book without FWAB_UID
#Hint: resize this window to full-screen to improve readability of the script(s)! #
Perform Script [ "Address Book Selector Availability Check" ]
#
#
Show All Records
Sort Records [ Keep records in sorted order; Specified Sort Order: Contacts::Sort List Key; ascending Contacts::Contact Name; ascending ]
[ Restore; No dialog ]
Go to Record/Request/Page
[ First ]
Loop
If [ IsEmpty( Contacts::FWAB_UID ) ]
Set Variable [ $Result; Value:FWAB_PutSingleValue( Contacts::FWAB_UID ; "LastName" ; Contacts::Last ) ] #Create Contact and store UID
Set Field [ Contacts::FWAB_UID; GetValue ( $Result; 1 ) ]
#
Set Variable [ $Result; Value:FWAB_PutSingleValue( Contacts::FWAB_UID ; "FirstName" ; Contacts::First ) ]
Set Variable [ $Result; Value:FWAB_PutSingleValue( Contacts::FWAB_UID ; "MiddleName" ; Contacts::Middle ) ]
Set Variable [ $Result; Value:FWAB_PutSingleValue( Contacts::FWAB_UID ; "Title" ; Contacts::Title ) ]
Set Variable [ $Result; Value:FWAB_PutSingleValue( Contacts::FWAB_UID ; "Organization" ; Contacts::Company ) ] Set Variable [ $Result; Value:FWAB_PutSingleValue( Contacts::FWAB_UID ; "Department" ; Contacts::Department ) ] Set Variable [ $Result; Value:FWAB_PutSingleValue( Contacts::FWAB_UID ; "JobTitle" ; Contacts::Job Title ) ]
Set Variable [ $Result; Value:FWAB_PutSingleValue( Contacts::FWAB_UID ; "HomePage" ; Contacts::Website) ]
Set Variable [ $Result; Value:FWAB_PutSingleValue( Contacts::FWAB_UID ; "Note" ; Contacts::Notes) ]
#
If [ not IsEmpty ( Contacts::Work Phone ) ]
Set Variable [ $Result; Value:FWAB_PutMultiValue_Phone(Contacts::FWAB_UID; ""; Contacts::Work Phone; "_$!<Work>!$_"; ""; "NO" ) ] End If
If [ not IsEmpty ( Contacts::Home Phone ) ]
Set Variable [ $Result; Value:FWAB_PutMultiValue_Phone(Contacts::FWAB_UID; ""; Contacts::Home Phone; "_$!<Home>!$_"; ""; "NO" ) ]
End If
If [ not IsEmpty ( Contacts::Mobile Phone ) ]
Set Variable [ $Result; Value:FWAB_PutMultiValue_Phone(Contacts::FWAB_UID; ""; Contacts::Mobile Phone; "_$!<Mobile>!$_"; ""; "NO" ) ] End If
If [ not IsEmpty ( Contacts::Fax ) ]
Set Variable [ $Result; Value:FWAB_PutMultiValue_Phone(Contacts::FWAB_UID; ""; Contacts::Fax ; "_$!<WorkFAX>!$_"; ""; "NO" ) ]
End If
If [ not IsEmpty ( Contacts::General Phone ) ]
Set Variable [ $Result; Value:FWAB_PutMultiValue_Phone(Contacts::FWAB_UID; ""; Contacts::General Phone ; "General Phone"; ""; "NO" ) ] End If
#
If [ not IsEmpty ( Contacts::Work Email ) ]
Set Variable [ $Result; Value:FWAB_PutMultiValue_Email(Contacts::FWAB_UID; ""; Contacts::Work Email; "_$!<Work>!$_"; ""; "NO" ) ]
End If
If [ not IsEmpty ( Contacts::Home Email ) ]
Set Variable [ $Result; Value:FWAB_PutMultiValue_Email(Contacts::FWAB_UID; ""; Contacts::Home Email; "_$!<Home>!$_"; ""; "NO" ) ] End If
#
If [ not IsEmpty ( Contacts::Work Address 1 ) or not IsEmpty ( Contacts::Work City ) or not IsEmpty ( Contacts::Work Province ) or not IsEmpty ( Contacts::Work Postal Code ) or not IsEmpty ( Contacts::Work Country) ]
Set Variable [ $Result; Value:FWAB_PutMultiValue_Address(Contacts::FWAB_UID; ""; Contacts::Work Address 1; Contacts::Work Postal Code; Contacts::Work City; Contacts::Work Province; Contacts::Work Country; ""; "_$!<Work>!$_"; ""; "NO" ) ]
End If
If [ not IsEmpty ( Contacts::Home Address 1 ) or not IsEmpty ( Contacts::Home City ) or not IsEmpty ( Contacts::Home Province ) or not IsEmpty ( Contacts::Home Postal Code ) or not IsEmpty ( Contacts::Home Country) ]
Set Variable [ $Result; Value:FWAB_PutMultiValue_Address(Contacts::FWAB_UID; ""; Contacts::Home Address 1; Contacts::Home Postal Code; Contacts::Home City; Contacts::Home Province; Contacts::Home Country; ""; "_$!<Home>!$_"; ""; "NO" ) ] End If
If [ not IsEmpty ( Contacts::Postal Address 1 ) or not IsEmpty ( Contacts::Postal City ) or not IsEmpty ( Contacts::Postal Province ) or not IsEmpty ( Contacts::Postal Postal Code ) or not IsEmpty ( Contacts::Postal Country) ]
Set Variable [ $Result; Value:FWAB_PutMultiValue_Address(Contacts::FWAB_UID; ""; Contacts::Postal Address 1; Contacts::Postal Postal Code; Contacts::Postal City; Contacts::Postal Province; Contacts::Postal Country; ""; "Postal"; ""; "NO" ) ]
End If
Set Variable [ $Result; Value:FWAB_SaveAddressBook ]
End If
If [ IsEmpty (Contacts::First) and IsEmpty(Contacts::Last) ]
Set Variable [ $Result; Value:FWAB_PutSingleValue( Contacts::FWAB_UID ; "ShowAsFlags" ; "1") ]
End If
Go to Record/Request/Page
[ Next; Exit after last ]
End Loop

Acties:
  • 0 Henk 'm!

  • Rupie
  • Registratie: Augustus 2006
  • Laatst online: 22:42
Tja, dat kan van alles zijn op deze manier natuurlijk. Van een onderdeel van het systeem wat je gebruikt (een extreem langzame HDD?), het systeem zelf (als je op een 486 zit te klooien gaat het wel even duren denk ik ja), software die op de achtergrond draait...

Wat heb je al getest? Als je bijvoorbeeld minder gegevens per record weg schrijft, scheelt dat dan veel? Misschien dat ik er over heen kijk, maar wat is de bron van de records die je weg wil schrijven?

Desktop | Server | Laptop


Acties:
  • 0 Henk 'm!

  • Mastha-Hacker
  • Registratie: Mei 2009
  • Laatst online: 02-12-2024
Het systeem waarop ik draai is snel zat. Een macbook pro retina met ssd.

De gegevens worden uit de database Contacts gehaald. Dit is de database die bij de layout hoort die gebruikt wordt.

EDIT:
Ik heb zojuist getest met het wegschrijven van 1 single value, 1 multi value en 1 adres.
Dit gaat sneller. (ongeveer 1 à 2 per seconde)

[ Voor 21% gewijzigd door Mastha-Hacker op 03-04-2013 15:00 ]


Acties:
  • 0 Henk 'm!

  • Mastha-Hacker
  • Registratie: Mei 2009
  • Laatst online: 02-12-2024
Is er iemand die mij hier mee kan helpen?

Acties:
  • 0 Henk 'm!

  • Mastha-Hacker
  • Registratie: Mei 2009
  • Laatst online: 02-12-2024
Probleem gevonden! :) Blijkbaar wordt filemaker traag als hij dingen moet wegschrijven als er geen data in dat veld is. Kheb het opgelost met een:

C:
1
2
3
4
5
Set Variable [ $Result; 
        If ( IsEmpty ( Contact::First ; 
                  "" ; 
                  Value:FWAB_PutSingleValue( Contacts::FWAB_UID ; "FirstName" ; Contacts::First ) 
         ) ]

[ Voor 8% gewijzigd door Mastha-Hacker op 16-04-2013 20:33 ]