• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Aatrix Mac P&L Modifing Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Aatrix Mac P&L Modifing Data


  • Subject: Aatrix Mac P&L Modifing Data
  • From: John Haley <email@hidden>
  • Date: Tue, 23 Jul 2002 11:29:35 -0500

I am not very good with original AppleScript. I will take what I can find and change it to my needs, but I cat't find much for Mac P&L. I want to modify customer information. I have tried:
tell application "Aatrix MacP&Lb"6.3.1 Client 4"
tell Database 1
tell Table "Customers"
set (Value of Cell "Name" of (every Record whose Value of Cell "CodeNumber" = "A2306")) to "Test Company"
end tell
end tell
end tell

which actually does change the name, but it takes about 4 minutes and it errors out with a time out error.
The scripts I have found, one which creates an account and one which pulls the information from the account, are bellow.

tell application "Aatrix MacP&Lb"6.2"
try --checks to see if there is a database open
get the Name of Database 1
on error --if there is no datatabse open, select one to open
choose file with prompt "Please select a MacP&L database to open:" of type "APB2" -- "APB2" only lists MacP&L databases
set fileName to result
Open fileName
end try

tell Database 1
-- make sure there are sales and tax accounts and they exsit in MacP&L
tell Table "GL Accounts"
-- once we have a valid ID, add the rest of the information
set theRecord to {vCustID, vName, vSalesAcct, vTaxAcct, vTerms, vAddress, " ", vCity, vState, vZip, vCountry, vPhone, vFax, " ", " ", 0.0, 0.0, vTaxRate, vDiscount, true}

try
Create New Record At end With Data theRecord
display dialog vName & " has been successfully added to MacP&L as a customer."
on error errMsg number errNbr
display dialog errMsg & return & return & "(" & errNbr & ")"
end try

end tell
end tell
end tell


-- get customer information from MacP&L, based on ID and Name from FileMaker
tell application "Aatrix MacP&Lb"6.2"
try --checks to see if there is a database open
get the Name of Database 1
on error --if there is no datatabse open, select one to open
choose file with prompt "Please select a MacP&L database to open:" of type "APB2" -- "APB2" only lists MacP&L databases
set fileName to result
Open fileName
end try

tell Table "Customers" of Database 1

repeat
if vCustID = "" then set vCustID to text returned of (display dialog "Please enter the ID number for this customer:" default answer "" buttons {"Cancel", "OK"} default button "OK")

--make sure the customer exists in MacP&L
try
(Value of Cell "Name" of (every Record whose Value of Cell "CodeNumber" = vCustID))
exit repeat
on error
display dialog "MacP&L does not have a customer with an ID of " & vCustID & "." buttons "OK" default button "OK"
set vCustID to "" --reset the customer ID
end try
end repeat

-- once we have a valid ID, set the rest of the variables

set vName to (Value of Cell "Name" of (every Record whose Value of Cell "CodeNumber" = vCustID))

-- now we need to combine the address fields for use in FileMaker
set tempAddr1 to (Value of Cell "Addr Ln1" of (every Record whose Value of Cell "CodeNumber" = vCustID)) --this gets line 1 of the address in MacP&L
set tempAddr2 to (Value of Cell "Addr Ln2" of (every Record whose Value of Cell "CodeNumber" = vCustID)) --this gets line 2 of the address in MacP&L

-- if there is a line 2 for the address, concatenate them and set vAddress
if tempAddr2 b "" then
set vAddress to tempAddr1 & return & tempAddr2
else
set vAddress to tempAddr1
end if

set vCity to (Value of Cell "City" of (every Record whose Value of Cell "CodeNumber" = vCustID))
set vState to (Value of Cell "State" of (every Record whose Value of Cell "CodeNumber" = vCustID))
set vZip to (Value of Cell "Zip" of (every Record whose Value of Cell "CodeNumber" = vCustID))
set vCountry to (Value of Cell "Country" of (every Record whose Value of Cell "CodeNumber" = vCustID))
set vPhone to (Value of Cell "Phone" of (every Record whose Value of Cell "CodeNumber" = vCustID))
set vFax to (Value of Cell "Fax" of (every Record whose Value of Cell "CodeNumber" = vCustID))
set vSalesAcct to (Value of Cell "Sales Account" of (every Record whose Value of Cell "CodeNumber" = vCustID))
set vTaxAcct to (Value of Cell "Tax Account" of (every Record whose Value of Cell "CodeNumber" = vCustID))
set vTaxRate to (Value of Cell "Taxable" of (every Record whose Value of Cell "CodeNumber" = vCustID))
set vDiscount to (Value of Cell "Discount" of (every Record whose Value of Cell "CodeNumber" = vCustID))
set vOpenAccount to (Value of Cell "Open Account" of (every Record whose Value of Cell "CodeNumber" = vCustID))

end tell
end tell
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
  • Prev by Date: Re: FileMaker Pro Help
  • Next by Date: Aatrix Mac P&L Modifing Data
  • Previous by thread: Re: Need script editor...??
  • Next by thread: Attaching Folder Action
  • Index(es):
    • Date
    • Thread