Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Good Afternoon,

I’ve written a script to create a virtual list of titles from two tables. The script is executed from a table B record. It first searches for the records in table B where the author is the same as the author on the table B record from which it is executed, and then for table A records with that same author.  Everything works fine as long as the table B record has only one author in the author field. When there is more than one, the script fails to loop through the table B author field. It looks like it is taking only the first author into account. The table B author field is based on a dropdown list of names all separated by a carriage return. I’m pulling my hair trying to understand why it’s not working.

Any help would be greatly appreciated. Thanks.

 

Script (part 1).PNG

Script (part 2).PNG

Posted

It's hard for me to follow your script but basically when pulling records like this, you probably need a loop in a loop.

Also, when doing a virtual list, you usually have to append the results in a variable (over and over when looping), local is faster, then move that entire value to a global variable if need be.

Virtual list requires that you pre-populate the table with more records than you could ever need, then performing a find on a field guaranteed to have a record, unless you're building your VL with repeating fields.

Probably the only way to solve this is with a sample file.

Posted

Thanks Steve,

As far as the virtual list is concerned, the script works just fine. It creates and populates the virtual list with all the found records. So that is not the issue I'm concerned with.

The problem I'm having is that the script does not find all the records it should find because, when there is more than one name in the authors field of table B (where the script is executed), the script searches table B records and then table A records only with the first name in the authors field. It should continue the search with the 2nd, 3rd, 4th name, and so on. So lines 8 to 18, and then 28 to 34 of the script need some adjustments, maybe as you say another loop. This is where I need some guidance.

Note that line 37 should read Set content of virtual list from books (not from acquisitions).

Thanks.

This topic is 1786 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.