Converting Related A and Related B

Questions and suggestions for the CC Calendar product.
Posts: 1
Joined: Mon Mar 01, 2004 11:44 am
PostPosted: Mon Mar 01, 2004 11:51 am
How can I convert and/or add dbs Related A and Related B to new uses. For instance, one would be a db of only client related items and the other would be a db of something like vactaion days.
SeedCode Staff
SeedCode Staff
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Mon Mar 08, 2004 5:54 am
David,

Some developers will find it easier and more satisfying to just dive into the files and repoint relationships as they go. For those who want a more step-by-step approach, I hope the following is useful.

You'd tackle both Related Items A and B the same way. So, taking Related Items A as an example...

Before you begin, please backup your files and make sure you have only 1 unstuffed copy of the relevant files on your machine.

1. The trick is to modify the existing relationships to RelatedItemA.fp5 so that they point to your file instead. You *don't* want to create new relationships unless you've already hooked the system up so that your items are showing where Related Items A used to be.

2. Lets assume the file you want to swap out is called Projects. Lets also assume each Project as a a few dates, a startdate, and an end date. Throughout this discussion I'll make notes where you'd change things if you're project has only one relevant date, not two.

3. We'll edit the relationship used on the Daily View and use this as a case study for the 7 relationships used on the week and month views. Go to the daily view in layout mode and double click on the Related Items A portal. Select Show Records from and then select Define Relationships. Click Edit for the highlighted relationship so that you're editing the ItemsAbyLinkDateGlobtoItemAKeyDateCalc relationship to RelatedItemA.fp5

We won't actually edit it, we're just looking at it to see what the right hand key is. The right hand key is the field in RelatedItemA.fp5 used as the right side of the relationship. In our case this is called ItemAKeyDateCalc.

4. Now go into RelatedItemA.fp5 and copy the definition for this field. You'll now move to your Projects file and create a new field with the same name "ItemAKeyDateCalc". Make this a calculation field and paste in the definition from RelatedItemA.fp5

5. This step you may need to try a few times, but the key is to replace each of the components of the calc from RelatedItemA.fp5 with the matching components from your project file. All you really have to do is replace "ItemAFldDateStart" with the field holding the start date of your project and replace ItemAFldDateDue with the end date of your project. (If you have only one date, you can simply replace all the date fields with your one date. This preserves the ability to toggle between one date type and another in case you wish to turn this on later.)

6. Make sure the calculation returns the type "text" and that it is indexable.

7. Now return to CCCalendar.fp5 and get ready to edit the ItemsAbyLinkDateGlobtoItemAKeyDateCalc relatinship using the method discussed in step 3. in the edit relationship dialog, click "Specify File" and locate your Projects file. Uncheck the "Save Relative Path Only" checkbox.

8. Once you've selected your file, you'll need to select the ItemAKeyDateCalc field you created in Projects to be used as the right side of the relationship.

9. Click the specify button beside "Sort Related Records" you could see a list of your Project fields. Select any fields you'd like to sort by. Remember, selecting an unindexed field will slow down performance. Sorting may not be relevant to your projects; if it is not, simply turn uncheck "Sort Related Records".

10. Accept the changes to your relationship and move back to CCCalendar.fp5. In layout mode, select each of the fields in the Related Items A portal. Double click on these to select the appropriate field from your Projects file. if you don't see the fields from your Project file listed, you likely made a mistake editing the relationship (or edited the wrong relationship) in steps 7 and 8.

11. Now to test the relationship. Find or create a record in Project with a startdate of 2/25/2004. Navigate to that day on the calendar's daily view. If you don't see the Project listed, move on to step 12. If you do see the project, move on to step 14.

12. The best way to troubleshoot your relationships is to place the key fields from both sides of the relationship on layouts in browse mode and make sure their contents are the same. Place LinkDateGlob on the daily view layout in CCCalendar.fp5, and place ItemAKeyDateCalc on some layout in your Projects file. navigate to our test Project and to the date for that project in CCCalendar's daily view.

13. Enter browse mode and make sure both fields match on at least one row. ItemAKeyDateCalc will contain more than 1 row of information so make sure you put your cursor in to see everything in the field. Adjust ItemAKeyDateCalc as needed so that at least one row of ItemAKeyDateCalc matches LinkDateGlob in the calendar.

14. Now that the relationship used on the daily view is working you have two more tasks. Edit the relationships used in the Week and Month views; and edit the scripts used to jump to Related Items A. (These scripts do not automatically "repoint" when you edit relationships.)

15. The relationships used in the week and month view are repointed the same way you did the ItemsAbyLinkDateGlobtoItemAKeyDateCalc relationship. But this time, it is easier to edit them through the Define Relationship menu. ONce you see a list of relationships you can sort them by related file. Find the 8 relationships to RelatedItemA.fp5; for each of these you'll edit the relationship, specify your projects file, select your ItemAKeyDateCalc field and change the Sort Order as you did in steps 7 - 9 above.

16. You'll also need to reselect the fields used on the Week and Month layouts as you reselected the fields in step 10. This can be complicated on the Month View as the fields have scripts on them. Take your time. (you might want to backup your files again at this point before you begin editing the layouts.)

17. The testing we did in steps 12 and 13 can be repeated here if your Project's don't show up. Note that the week and month relationships use a different field on the left side. And, each weekday uses a different left hand key. Likely if one is broken they are all broken for the same reason, so pick one of the calcs and place ThirtyDayRelatedItemsABKeyCalc2 (for instance) on a layout in browse mode as we did in Step 12. Note that these calcs use the "start / due" filter. You may need to click "filter" on the related Items A month view to make sure this is set to "start" for testing.

18. Note you can edit the words "Start" and "Due" if they don't meet your needs. Just be sure to change their counterparts in ItemAKeyDateCalc to use the same terminology.

19. Once you can see your Projects in the Daily, Weekly, and Month views, you'll want to edit a few Scripts in CCCalendar.fp5. Check out the "Go to Item A from Daily" script in CCCalendar.fp5. The Go to Related Records part of this changed when you edited your relationships. However, the Perform External Script step is still calling a script in RelatedItemsA.fp5. You'll want to edit this script to call some kind of "arrive at project" script in your Projects file.

20. You'll do the same for the scripts "Go to Item A from 30 Day 1" through "Go to Item A from 30 Day 8". For each of these there is also a "Go to Field" step you'll want to edit. This step takes you *into* the field shown on the calendar so that you can read more than one line of it. You can see an example of how this works on Related Items B's month view.

21. Note that the calendar is not set up to *create* Related Item A or B records, and is thus not set up to create Projects in your Projects file. You likely already have scripts and layouts for entering new Projects... Projects which should now be visible in your calendar.

Enjoy!
John Sindelar
SeedCode

Return to CC Calendar (FM6)

Who is online

Users browsing this forum: No registered users and 1 guest

(855) SEEDCODE
[email protected]
Follow us: