Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Referential Integrity, link on multiple fields

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Referential Integrity, link on multiple fields

    In most of the sets I have now, I have to not have any referential integrity, because Alpha V insists on having only one linked field for referential integrity. Is there anyway around this? What happens to me if I don't have referential integrity included is I have to duplicate the data entry in 2 or more fields between linked tables in the set. Its always been a drag, but I've never known any other way to do what I need to do.

    Any ideas?

    Thanks,


    Bruce Roberson

    #2
    Re: Referential Integrity, link on multiple fields

    One way might be to create a link field that is a combination of the two fields you want to pass to the child.

    Ex: Create a field called KEYLINK and set its value to
    ut(CUSTNO)+"-"+ut(INVNO) as a calculated field. Add that same field to the child table as a user entered type and link your set on that field. In the child table set the calculated value for the CUSTNO field to word(keylink,1) and in the INVNO field to word(keylink,-1).

    Note: You may have to run an Update operation before setting the field rule for KEYLINK to calculated to get the field populated for your existing records in the parent table.
    Last edited by MoGrace; 05-17-2007, 04:26 PM.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

    Comment


      #3
      Re: Referential Integrity, link on multiple fields

      Ex: Create a field called KEYLINK and set its value to
      ut(CUSTNO)+"-"+ut(INVNO) as a calculated field

      These calculated fields work, and I did the update before putting in the field rules


      In the child table set the calculated value for the CUSTNO field to word(keylink,1) and in the INVNO field to word(keylink,-1).

      I guess this would of worked, but field 1 could and often did have 2 or more parts, and field 2 always had 2 characters, so I had to do the following instead:

      Child Table, Field 1 field rules = LEFT(KEYLINK,LEN(TRIM(KEYLINK))-3)
      Not sure why -3 was needed instead of -2 but that is how it works now.

      Child Table, Field 2 field rules = RIGHT(TRIM(KEYLINK),2)


      I would of used the "words" function if I could of made it do what I wanted, so I wasn't sure how to make it pick more than one word with the function "word"

      Comment


        #4
        Re: Referential Integrity, link on multiple fields

        Bruce,
        There are many variations for extracting the string you need - I just put up a simple one. So is this going to work for you? The AT() function could also be used since we added the '-' character to separate the fields joined together.
        Robin

        Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

        Comment


          #5
          Re: Referential Integrity, link on multiple fields

          Originally posted by BruceA5V4 View Post
          I would of used the "words" function if I could of made it do what I wanted, so I wasn't sure how to make it pick more than one word with the function "word"
          Output_String as C = WORD( Input_String as C, Word_Number as N [, Word_Delimiter as C [, Word_Count as N ] ])
          ? word("now is the time", 2, " ", 3)

          = "is the time"
          There can be only one.

          Comment


            #6
            Re: Referential Integrity, link on multiple fields

            Bruce, I'm curious why you're building compound keys to link your tables together? In many apps it's not necessary for the user to ever see the link field values. For my own apps I try hard to keep things simple and avoid using a single field for multiple purposes. -- tom

            Comment


              #7
              Re: Referential Integrity, link on multiple fields

              Tom:

              I have a three tiered set approach in many of my sets so I can have an embedded browse table to view child records, and then a tab for history records of oil and gas severance tax where those records relate to the first child in a one to many relationship.

              For example, the parent table is a property name, number, and product code, be it oil or gas. Then, the first child that has a one to many relationship set up needs to link to both the property and the product code of the parent, thus the linking of two fields in this case with the field keylink. The reason I want to have separate parent records for each product within a property name is the third level down, which is a child to the first child (a grandchild if you will). The linking between the child and the grandchild has four fields.

              I have a property form setup where I setup both the parent and child at the same time, and want it to cascade adds and deletes, thus the need for referential integrity.

              Sorry for the short lesson in oil and gas severance in taxation etc but the child will have a property name, then it can have multiple records with the same property name in which it has one or more PUNs and suffixes, which are two additional fields in the child, and then the product code, that links both to the parent as well as grandchild. For the second link at this point, I am not worrying about the keylink concept because the grandchild is a history of payments that are imported each month from Excel, rather than entered manually.

              After all that response, am I missing something in the way I arranged my sets all these years, given the level of detail I want to view, print and query data on?

              Bruce

              Comment


                #8
                Re: Referential Integrity, link on multiple fields

                Bruce, if it's working for you then don't change it. I've seen situations over the years where folks design their link fields so that the field value itself is meaningful to the user. These are put together from other fields or pieces of other fields so that a unique value is ultimately produced. This of course is required. The link field value must uniquely identify the linked child record.

                Where the design will fail however is if the user is permitted to edit some of the subsidiary field values after the new record is entered. Say, for example, in your case, if the user changes a product code in a child table. I'd be worried that this would break the link between that record and the original parent table record.

                But, as I say, if it's working don't change it!

                -- tom

                Comment


                  #9
                  Re: Referential Integrity, link on multiple fields

                  Tom,
                  He was looking for a way to pass the needed values to the other fields used as links to other tables. I suppose it would require that these child records only be created in this set. Since in the child the fields are calculated values, they could not be changed unless the parent key fields are changed which in turn updates the link field and the calc fields. I suppose he would have to be careful not to show the linking field to the user in the child, since it could be changed.
                  Robin

                  Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                  Comment


                    #10
                    Re: Referential Integrity, link on multiple fields

                    I would love to see the linking schematic and details in set form for this one. Thought I was the only one did wierd things.

                    Like Tom said, if it works, dont change it.

                    Dave
                    Dave Mason
                    [email protected]
                    Skype is dave.mason46

                    Comment


                      #11
                      Re: Referential Integrity, link on multiple fields

                      Originally posted by DaveM View Post
                      I would love to see the linking schematic and details in set form for this one. Thought I was the only one did wierd things.

                      Like Tom said, if it works, dont change it.

                      Dave
                      Beauty is in the eye of the beholder...
                      Robin

                      Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                      Comment


                        #12
                        Re: Referential Integrity, link on multiple fields

                        I have the same issue, I am going to give this a try. I have a three tear set due to an extremely awkward item rates scheme.

                        The first table is a workorder table and contains
                        WO_Num
                        Job_ID
                        Customer_ID
                        Contact_ID
                        Address
                        Date_start
                        Date_end

                        The second table is a worksheet and has a one to many and multiple field link.
                        Wrksht_Num
                        Job_ID
                        WO_Num (workorder->wo_num)
                        Cust_ID (workorder->cust_id)
                        Cont_ID (not linked because it may be different than workorder)
                        Time_start
                        Time_end
                        Bill_Rate_id
                        Pay_rate_id
                        Total_Billed
                        Total_Cost
                        Total_Paid

                        The third tier table is a worksheet_items table with a one to many and multiple field link to the worksheet table
                        WS_Item_ID
                        Item_Code (*Field Rule Lookup Table; as described below)
                        Description
                        Units
                        Wrksht_ID(worksheet->wrksht_id)
                        Cust_ID (worksheet->cust_id)
                        Pay_rate_ID (worksheet->payrateid)
                        Bill_rate_id (worksheet->billrateid)
                        Bill_Rate
                        Pay_rate

                        *The worksheet_item->item_code field has a lookup table field rule to the Item_Rates table. The Item_rates table lookup field rule contains a filter (item_rates->Cust_ID = worksheet_items->Cust_id). The Item_rates table contains the following fields

                        Rate_ID
                        Cust_ID
                        Item_Code (fills the worksheet_items->items code field)
                        Description (fills the worksheet_items->description field)
                        Units (fills the worksheet_items->Units field)
                        Bill_Rate1 (fills the worksheet_items->Bill_rate field if Bill_rate_ID = bill1)
                        Bill_Rate2 (fills the worksheet_items->Bill_rate field if Bill_rate_ID = bill2)
                        Pay_rate1 (fills the worksheet_items->Pay_rate field if Pay_rate_ID = pay1)
                        Pay_Rate2 (fills the worksheet_items->Pay_rate field if Pay_rate_ID = pay2)
                        Pay_rate3 (fills the worksheet_items->Pay_rate field if Pay_rate_ID = pay3)
                        Sub_Rate1 (fills the worksheet_items->Pay_rate field if Pay_rate_ID = pay4)
                        Sub_Rate2 (fills the worksheet_items->Pay_rate field if Pay_rate_ID = pay5)
                        Sub_Rate3




                        The reason for all this is because each customer has it's own unique set of bill rates, pay rates, and sub rates for each unique item_code. The customer also wants the option to change the bill_rate or pay_rate for each item on each worksheet because of variables such as location of item being installed, night job, weekend job, bad weather, etc...

                        I will let you guys know if the method posted above works in this scenerio but this is the situation where i see no other way to meet the clients needs
                        Lee Goldberg
                        Software Development and Sales
                        Shore Consultants Ltd.
                        [email protected]
                        www.shorecon.com

                        Comment


                          #13
                          Re: Referential Integrity, link on multiple fields

                          Lee, another option is to run the set without referential integrity enabled, right? You control edits to the parent table. If a change or delete occurs that should be cascaded down to related children you script that to occur behind the scenes. -- tom

                          Comment


                            #14
                            Re: Referential Integrity, link on multiple fields

                            Tom, that seems like a lot of scripting if i am linking a lot of fields. What would be the advantage to scripting those changes? Do you think it would be easier?
                            Lee Goldberg
                            Software Development and Sales
                            Shore Consultants Ltd.
                            [email protected]
                            www.shorecon.com

                            Comment

                            Working...
                            X