Jump to content
Server Maintenance This Week. ×

referencing by record # in a found set


This topic is 5591 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Here is the problem I am having, lets say I have a database with 6 records, and in those records is a field called "Status". Now lets say the first 4 records have the "Status" field set to "done" and the last 2 have it set at "Active".

Now, if I do the following (show every record whose field "Status" = "Active"), it will give me a found set with just the last 2 records. But if I then try to loop thru these 2 records and extract info this way:

repeat with i from 1 to 2

set New_Client to field "Customer_info" of record i

end repeat

I will get the value from the records with the value "done", since the (record i) reference is to the whole database not the found set. How do I loop thru only the found set records?

Now I realize I could just extract all values of the "Status" field into a list using: set New_Client_List to ((field "Customer_info" of every record whose field "Status" = "Active") as list)

But for reasons too long to explain here, I really need to be able to pull out values from a record in the found set by a sequencial reference.

Anybody know the syntax for that?

Manuel

Edited by Guest
Link to comment
Share on other sites

repeat with i from 1 to 2

set New_Client to field "Customer_info" of record i

end repeat

Either do you loop thru the set with "Cell", or you write to "Field" which is the entire column if seen in table view and if you write "document" instead of "database" is it the found set. (seems to me it's a repetition from yesterday) You can compare the two form as Set Field or Replace in native scripting. Replace is the shotgun, while Set Field is a riffle. So a reply must be:

Beyond that do I not see a particular need for substituting native methods in applescript, and have a general hunch telling me that scripting might be a remedy for a pooly relational structured solution. Reserve the applescript use for porting data in and out of filemaker ... where it can be second to none - but for the inner mechanics is it not worth it.

--sd

set myCount to count of records

repeat with i from 1 to myCount

set cell 2 of record i to "bb"

end repeat





But the same thing could be written this way:




set field 2 to "bb"
Link to comment
Share on other sites

I'm using applescript because I need the database to interact with the underlying OS X Server's LDAP. I do some of that interaction with scodigo's smartpill but some of it I do in applescript, such as creating users and groups.

Manuel

Link to comment
Share on other sites

This topic is 5591 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.