Discussions

 View Only
  • 1.  Populate based on Current User

    Posted 04-25-2017 18:29

    I have multiple tables in my application. Listing the ones that are related to my query.
    Team, Owners, Calendar Entries and Staff table.

    The Staff table is nothing but a list of all staff members. The Owner table is related to the Staff table and the Team Table. Each Team can have more than one Owner. The Owner table has a user field called 'Staff-user' and this is populated based as a look up field.

    The Calendar Entry table is also related to the team table.


    What am I trying to achieve?
    Every time I log into the Calendar Entry table,it should show me records only where the Calendar Team selected is the same as the current user's team. In order to do it I need to fetch Team related to the current user from the Owner table.

    IMO, One simple way to achieve this is use Report Links, but unfortunately I cannot convert that into a field to be able to compare it.


    Any suggestions? I am really stuck and could use some help here..


    Thanks in advance







  • 2.  RE: Populate based on Current User

    Posted 04-25-2017 18:53
    Can you describe all the relationships between these 4 tables. It is not clear which are the parents and which are the children.


  • 3.  RE: Populate based on Current User

    Posted 04-25-2017 18:56

    Team is the parent for Owners and Calendar Entries.

    Staff is the parent to the Owners table.

    Owners is also the parent to Calendar Entry.




  • 4.  RE: Populate based on Current User

    Posted 04-25-2017 19:11
    I think that this one is easy, but tell me first where is the userid for the user that you are trying to match on is stored.  Is it on the owners table or the staff table.


  • 5.  RE: Populate based on Current User

    Posted 04-25-2017 19:17
    So the Staff table originally has all the users loaded which is the parent to the Owners table.
    The Owner table has the users too as a part of the lookup fields trickling down from Staff table.


  • 6.  RE: Populate based on Current User

    Posted 04-25-2017 19:21

    Posting a part of the relationship diagram. Hope this helps you to understand the table relations better



  • 7.  RE: Populate based on Current User

    Posted 04-25-2017 19:49
    Ok, here goes. It's not that  difficult.

    Make a  formula numeric field on the Owners table called [I am the current user (=1)]
    Make the formula to be 

    IF([userid]=user(),1,0)

    It will calculate to 1 if true.

    Make a summary field for the maximum of that field up to the Team table.  Call it

    [I am the on this Team (=1)]

    It will be 1 io I (the current user) is on this Team.

    Lookup the field 

    [I am the on this Team (=1)]

    down the Calendar entries table.

    You can now filter your Calendar report where that field =1, or use it as a Dynamic filter if you make a new  formula text field  yes no type field  called [My Team?] with an IF formula.


  • 8.  RE: Populate based on Current User

    Posted 04-25-2017 20:53

    Works like a charm.

    Thank you for your inputs. Really helpful



  • 9.  RE: Populate based on Current User

    Posted 04-25-2017 20:59
    I call that my "shine the light" process.  Using that technique you can snake your way down lookup fields (easy and obvious) or up though summary fields (still easy but not obvious).  You can get though ridiculously complex relationships that way.  I think of it like shine a blue light into one end of a tunnel and watching it come out the other end.


  • 10.  RE: Populate based on Current User

    Posted 04-25-2017 21:06
    Like you said, easy but not obvious. Going forward, will definitely keep this in mind. Learnt something new today :)
    Really appreciate your help