8 Replies Latest reply on Mar 29, 2011 2:09 PM by philmodjunk

    Not sure why correct data is not showing in portal

    yuichim

      Title

      Not sure why correct data is not showing in portal

      Post

      Hi,

      For some reason, I can't seem to display the correct date in the portal.
      I have couple of tables related and wanted to display the correct company name and city but it for some reason, the first record's city is repeating in the portal.

      Here is the relationship and data that I have...

      I am displaying in the Layout (Users) with OrderItems Portal

      Users ---> Accounts ---->Orders-->OrderItems

      First, I was pulling the account name and city info directly from the Accounts table when you add a field to display but the data was not showing correctly (repeating the first record), so what I did was : created a calculation field in OrderItems table to get the Accounts:accountName and City.

      So, when I display the  OrderItems::AccountName (calculation field), then all records of account name displays correctly, but when I try to display from Accounts::accountName, then it just repeats..... 

      All of this is happening in the portal.  

      Any idea why this is happning?

        • 1. Re: Not sure why correct data is not showing in portal
          philmodjunk

          Portal to what table occurrence on layout based on what table occurrence?

          Are all these one to many relationships as you move from Users to OrderItems?

          Which would give you these relationships?

          Users::UserID = Accounts::UserID
          Accounts::AccountID = Orders::AccountID
          Orders::OrderID = OrderItems::ID

          Why aren't these fields defined in the Users table?

          • 2. Re: Not sure why correct data is not showing in portal
            yuichim

            Phil,

            I had to fix the Users::UserID -> Accounts::UserID because it was many to many.
            Now it is one to many relationship.  So it is all one to many relationships as we go from Users to OrderItems.

            When you say why these fields aren't defined in the Users table, what do you mean by that?

            • 3. Re: Not sure why correct data is not showing in portal
              philmodjunk

              Just a question based on curiosity. The fields would seem to belong in Users.

              Does it now work for you?

              • 4. Re: Not sure why correct data is not showing in portal
                yuichim

                Unfortunately not completely.   The funny thing is that now the accountName is displaying correctly with correct number of rows but the city is still repeating.
                I added 4 test records in the OrderItems table to desplay the records.
                Here are two snapshots that I took.

                • 5. Re: Not sure why correct data is not showing in portal
                  philmodjunk

                  You'll need to modify your relationships or the layout to correct this. What's happening is that the data is in accounts but your layout refers to Users and the portal refers to order Items.

                  I think these your Relationships:

                  Users----<Accounts---<Orders---<OrderItems   (---< means one to many )

                  When referring to fields more than one table occurrence away, you have to trace from table occurrence to table occurrence with great care to figure out why you get what you are getting.

                  Start with OrderItems, You have to go from there to Orders to Accounts to Users and then Back to accounts to get to the City field. That last step is from one to many records so you end up linking to the first Account record for that User--which apparently stores "Castle Hayne" in its city field. I predict that this portal's relationship enables the creation of related records. That would explain the 5th city showing in your portal. (in a sense, the layout is telling you that any new record will also display "Castle Hayne" on this Users record.)

                  To fix it, you could base your layout on Accounts.

                  You can also add these additional table occurrences:

                  OrderItems>---Orders2>---Accounts2

                  and then add a field from Accounts2 to the portal row instead of from Accounts.

                  • 6. Re: Not sure why correct data is not showing in portal
                    yuichim

                    I think I solved the issue!  I added a calculation field in the OrderItems called calc_city and pulled the field from Accounts::city.

                    Now when I put the merge field OrderItems::calc_city the data shows correctly!

                    I still don't understand why this is correct.. but at least it is working!

                    • 7. Re: Not sure why correct data is not showing in portal
                      yuichim

                      Thanks for your response Phil,

                      Well, what I did was your second option.

                      I added:

                      Users---<AccountsPA---<OrdersPA-----<OrderItemsPA

                      I added the AccountsPA::city but it is still repeating.  (Now there was a "allow creation of records" in the ordersPA---<OrderItemsPA relationship and I removed it. Now it is not shoing that "1" extra row :)  )

                      • 8. Re: Not sure why correct data is not showing in portal
                        philmodjunk

                        That's not my second option. I only posted the new stuff added to the right of the original table occurrences. The complete graph would look like this:

                        Users----<Accounts---<Orders---<OrderItems>---Orders2>---Accounts2

                        Select fields for your OrderItems portal from OrderTiems, Orders2 and Accounts2. Keep your layout based on Users.