Jump to content

Problem with working a array


ZzingG
 Share

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

Recommended Posts

Hopefully this in the correct area. Sorry if it is not.

I am working on a Christmas card, other holiday card sending database. It tracks what attorneys want to send holiday cards to what clients. This is a many to many relationship and as such I have a join file in the middle. I have the need to print a report that shows the cards that a attorney or group of attorneys need to sign before they are sent. In helping to generate this report I have a array that is built on each record in the client file. This array is the names of the attorneys that need to sign this clients card. The join file then has a field that is a unstored calculation that copies that array to itself from clients so that I can print out reports, and matching labels, in groups.

This system is working fine but I need to fine tune it. The problem is that ATTORNEY1,ATTORNEY2 is seen as different than ATTORNEY2,ATTORNEY1 even thou it is the same names. Is there a (easy, hopefully) way that I can sort the contents of the array so that the names are in a standard order not in the order they are added(like it is now)? Either with some sort of script as I print the report or as the array is created ang updated. It is changed on the fly right now. As attorneys get added or removed from a client list the array is updated.

Or maybe I am doing it the hard way and there is a better way.

Thanks for the help

Link to comment
Share on other sites

Sorry about that should have said. The array is a text field that is then formatted in the following way as it is created or modified.

AttorneyName/AttorneyName/

The array can be any size depending on the number of attorneys signing a card. There is a max of 30 attorneys in the firm. Max that I have seen in use is 7 names.

Link to comment
Share on other sites

That is correct, but I am also wanting to reference all clients that have the same attorneys that want to send them a holiday card. What I am doing right now is using the Attorney_Array field in the join file to find all the clients that have the same Attorney_Array and then print them out. The problem is that Attorney1/Attorney2 is seen as different than Attorney2/Attorney1, even thou it is the same names, just different order. I think that I, some how, need to sort the connents of the text field that is the array so that names get added in a order that is the same across all records.

I was also thinking maybe some sort of selfjoin relationship but was not sure how to limit it so that I only saw, as a example, the records for Attorney1/Attorney2 array and not all records for Attorney1 and Attorney2.

Thanks again

Link to comment
Share on other sites

You could create a SelfJoin by this record_ID, and a value list based on that field, using this SelfJoin. The ValueListItems ( ) would give you a sorted array (unstored).

In order to use it in a relationship, you'd need a single script at the moment of creation/modification, along the lines of

SetField[indexedSortedList, ValueListItems(Status(CurrentFileName),"MyAttorneyValueSbySJ")]

If you need to do it for all records, then use a loop script to reset all values to the new sorted list.

BTW, just noticed Queue answered priorly.

If the value were entered via Checkbox fields( even if not actually), you could check JT's file "SortCheckbox" that he just did for me some time ago.

It explains it all.

HTH

Link to comment
Share on other sites

Thanks for the links. I have looked at these files and they are going in the direction that I think I need to go. They both do what I want to do on a small scale. I have ~30 names.

Lee, The One Line Value list looked interesting but I have over 30 names that I would need to sort, and the names change as attorneys join or leave the firm so updating a calc field each time that happened would be a pain.

Ugo, I have been looking at the sorting checkboxes and can't say I fully understand what is going on yet thou. Will keep looking at it cause I think that that might be what I needing to do, just with out the check boxes.

Thanks again for the pointers to this info. Something to chew on and allow me to learn something new today. smile.gif

Link to comment
Share on other sites

This topic is 6584 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
 Share

×
×
  • Create New...

Important Information

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