Jump to content

  •  

Photo

Portal to display data from a Second Level Relationship

portal relationship

  • Please log in to reply
9 replies to this topic

#1 bleapy  newbie

bleapy
  • Members
  • 12 posts
  • FM Application:13 Advance
  • Platform:Mac OS X Mavericks
  • Skill Level:Novice
  • Time Online: 12h 54m 41s

Posted 23 July 2014 - 07:32 AM

I am having a problem in showing data from a second level relationship (not sure if this is the correct term).

Here's the scenerio.  Every year, I need to create new funds and expenses are created (PO, Direct Payment, Credit Card, Travel Expenses, etc) However, PO and Travel Expenses can be split funded by multiple funds. So when an expense is created it's not tied to the Fund, the Expense ID is created, and with in that the Expense Line. The Expense Line will contain a Fund field to tie it to the Fund Table.  So my table relationship looks like this

 

Fund --< Expense Line >-- Expense

 

Now I want to show all the Expense related to the Fund table and Sum up all the Expense Line that is funded by the Fund. I have a field in the Expense Table "Total Fund" which is a ExecuteSQL:

ExecuteSQL (
"SELECT SUM(Amount)
FROM Expense_Line
WHERE KF_ExpenseID = ? AND KF_FundID= ? "
; "" ; "" ; EXPENSE::KP_ExpenseID; FUND::KP_FundID

)

 

However, this was not pulling up the right data. Any suggestions? Let me know if you want to see the file on what I have now.

 

Thanks


  • 0

#2 eos  Paris 2016 … :-)

eos
  • Members
  • 1,176 posts
  • LocationTegernsee, Bavaria
  • FM Application:13 Advance
  • Platform:Mac OS X Mavericks
  • Skill Level:Intermediate
  • Membership:TechNet
  • Time Online: 222d 15h 2m 53s

Posted 23 July 2014 - 07:55 AM

When you're in the context of Expenses, which primary Fund key do you expect to see via LineItems?

 

Sum up all the Expense Line that is funded by the Fund

 

Yes – which Fund?


  • 0

#3 bleapy  newbie

bleapy
  • Members
  • 12 posts
  • FM Application:13 Advance
  • Platform:Mac OS X Mavericks
  • Skill Level:Novice
  • Time Online: 12h 54m 41s

Posted 23 July 2014 - 08:27 AM

In the Expense table, there are no direct relation to Fund.  But when I'm in the Fund Layout with the Expense Portal, I figure that the SQL will be able to Pull the Current FundID that I'm browsing. Maybe that's not the case?

 

Maybe, I need to have a Global Field for the Current Fund ID that I'm browsing?


  • 0

#4 eos  Paris 2016 … :-)

eos
  • Members
  • 1,176 posts
  • LocationTegernsee, Bavaria
  • FM Application:13 Advance
  • Platform:Mac OS X Mavericks
  • Skill Level:Intermediate
  • Membership:TechNet
  • Time Online: 222d 15h 2m 53s

Posted 23 July 2014 - 09:24 AM

Actually, I'm not sure what it is you want to calculate in which context:

 

• when you browse through Funds, do you want to 1) see the sum of all line items related to the current fund, or 2) the sum of all line items related to the current fund and a specific Expense?

 

• when you browse through Expenses, do you want to do the same (in reverse)?


  • 0

#5 bleapy  newbie

bleapy
  • Members
  • 12 posts
  • FM Application:13 Advance
  • Platform:Mac OS X Mavericks
  • Skill Level:Novice
  • Time Online: 12h 54m 41s

Posted 23 July 2014 - 10:57 AM

EOS, I want to sum up all the Expense Line related to the current fund and a specific Expense.

 

Layout w/Fund Table

Will contain Fund Details (ie Beginning Balance, Fund Description, Year, etc)

 --- Expense Portal

      --- Portal Lines will contain the Expense details, and the SUM of Expense Line related to the fund and Expense

 

I've attached 3 screen shots. Expense Layout, Fund Layout 1 and Fund Layout 2

(Fund Layout 1) Fund ID 1 Total is correct in the (Expense Tab) Portal Actual is Correct $113, but when I go to FundID 2 (Fund Layout 2 Screen Shot) the Actual should be $1000, but it remains to be $113.

 

In Fund Layout, I would like to show the sum of all the expense line that are related to the fund (Box on the Top Right)

When I'm browse through the expense I don't need to see the sum of the funds, but it will show the sum of the related expense Lines. Which I have already.

 

 

Attached Thumbnails

  • Fund Layout 1.jpg
  • Fund Layout 2.jpg
  • Expense Layout.jpg

  • 0

#6 eos  Paris 2016 … :-)

eos
  • Members
  • 1,176 posts
  • LocationTegernsee, Bavaria
  • FM Application:13 Advance
  • Platform:Mac OS X Mavericks
  • Skill Level:Intermediate
  • Membership:TechNet
  • Time Online: 222d 15h 2m 53s

Posted 23 July 2014 - 12:37 PM

I've attached 3 screen shots. Expense Layout, Fund Layout 1 and Fund Layout 2

(Fund Layout 1) Fund ID 1 Total is correct in the (Expense Tab) Portal Actual is Correct $113, but when I go to FundID 2 (Fund Layout 2 Screen Shot) the Actual should be $1000, but it remains to be $113.

 

Why? There are the same travel line items in both fund records, adding up to $113 in each case. Where is the figure of $1,000 supposed to be coming from? – I can see a line item in the Expenses table of $1,000 for fund #2, but that doesn't show up in the fund record. Are you sure your relationships are correctly defined?

 

I guess I'm not understanding the setup, or the relation between a Fund and an Expense as you use them; sorry … 

 

btw, if you use ExecuteSQL() in a field definition (which I was given to understand may not be the best practice anyway), be sure to make the field unstored, or the results won't update properly.


  • 0

#7 bleapy  newbie

bleapy
  • Members
  • 12 posts
  • FM Application:13 Advance
  • Platform:Mac OS X Mavericks
  • Skill Level:Novice
  • Time Online: 12h 54m 41s

Posted 23 July 2014 - 03:45 PM

Sorry for not being more clear. I'll trying to explain. And thank you again for taking the time to help with this. 

 

Regarding the 3 Screen Shots.

 

Here's the process I had in mind steps.

1.  At the beginning of the year I would create a Fund in the Fund Table.

 

2. Create an Expense in the Expense layout by clicking on a Button in the Fund Table. The button uses a script to go to the Expense layout and create a new record, captures the FiscalYear field pulled from the Fund and enters it into a FiscalYear field in the Expense table. The FiscalYear does not tie the Fund and Expense Table together.

 

3. Once the Expense is created, I'll be entering items into the Expense Line item portal.  Each Expense Line will have a Funding Source, which will be a Filter Drop Down Value to get the Fund ID that's available in that particular Fiscal Year.  So, if I had purchased 2 computers on the same PO, I would be able to charge 1 computer to Fund 70000 and 1 computer to 48110. If you look at the Expense screen shot, $113 is charged Fund 70000 (FundID 1) and the other $1000 is charged to 48110 (Fund ID 2).

 

What I want to do is be able to see the Total of the Expense related to the Fund that I'm browsing. So Expense Portal (Expense Tab) for Fund ID 1 should only show a total of $113, and Fund ID 2 will show a total of $1000. But that does not seem to be the case. And I can't figure out why.

 

I've attached a screenshot of my relationship.

 

4. Based on the relationship, I can create a Portal of the Expense Line in the Fund layout, I believe that would calculate the correct value, because it has a direct relationship using the FundID as the common key. But I don't want to see every Expense Line.

 

Can you send you the FM file and take a look at what I have?

 

Thanks again!


  • 0

#8 eos  Paris 2016 … :-)

eos
  • Members
  • 1,176 posts
  • LocationTegernsee, Bavaria
  • FM Application:13 Advance
  • Platform:Mac OS X Mavericks
  • Skill Level:Intermediate
  • Membership:TechNet
  • Time Online: 222d 15h 2m 53s

Posted 24 July 2014 - 04:11 AM

OK, why don't you take a look into the attached file? Maybe this will give you some inspiration …

Attached Files


  • 0

#9 bleapy  newbie

bleapy
  • Members
  • 12 posts
  • FM Application:13 Advance
  • Platform:Mac OS X Mavericks
  • Skill Level:Novice
  • Time Online: 12h 54m 41s

Posted 24 July 2014 - 08:52 AM

EOS... From the looks of it, your setup would work for me. But now I'll need to figure out what you did and implement it on to mine. I'll keep you posted. Thank you.


  • 0

#10 bleapy  newbie

bleapy
  • Members
  • 12 posts
  • FM Application:13 Advance
  • Platform:Mac OS X Mavericks
  • Skill Level:Novice
  • Time Online: 12h 54m 41s

Posted 28 July 2014 - 01:41 PM

EOS, the sample you gave me was GREAT. I didn't use the structure entirely, what I was missing was the Global value to establish a 2 value relationship in another TO. Thank you for your help!


  • 0





FMForum Advertisers