connecting objects

  • 1
  • Question
  • Updated 4 years ago
  • Answered
Hi,

I have an object called "claims".  I created a lookup field on this object so i could access another object called "Payments".  This field looks like this:


Now, in Skuid, i can see the payments object and see the field i'm trying to add to my table (Payment_Date).  





I added Payment_Date to my claims table, but I'm not getting any data to pull into this field on my table.



Any ideas what I'm doing wrong?

Thanks!  I appreciate any help in resolving this!
Kris
Photo of Kris

Kris

  • 574 Points 500 badge 2x thumb

Posted 4 years ago

  • 1
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Can you confirm that these Claim records in your table have an associated Payment? Can share a screenshot showing both fields in the same table where the Payment field has data and the Payment Date does not?
Photo of Kris

Kris

  • 574 Points 500 badge 2x thumb
Hi Pat,

Thank you for your response.   the problem is setting up the lookup to the payment object - i don't know what i have wrong, but those are the ones that don't work.   i can see and grab the fields in skuid to put them into the table though.......


Here is what it looks like:





Here is what the field Total Charges looks like:



And the payment date:


I also tried to just go directly to the payment object, which didn't work either:



Please let me know if you have other questions.  Thanks for any input!
Kris
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Kris,

Forgive me for being overly simple here. Have you input a value for Payment__c in your Claims object? Otherwise, Claims won't know what row to pull data from to get the values in the Payments object.

Create a quick table on your claims object with the following fields: Id, Payment__c, Payment__r.Payment_Date__c.

If there's nothing in the last two fields, there's you're problem. Fill in a value for Payment__c, and the value for Payment_Date__c should appear.
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Kris and I are both driving at the same thing. Unless you've set the reference in the payment lookup, then you have nothing to relate to. Put the Payment__c field on the table. Is there anything in that field. If not, that's your problem.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Pat means to say, "Kris, Matt and I are both..."
Photo of Kris

Kris

  • 574 Points 500 badge 2x thumb
Thank you both for helping me!  I'm still learning how all this works, so all of this is very helpful.
Photo of Kris

Kris

  • 574 Points 500 badge 2x thumb
Hi Matt,

Thank you for your reply!  I need it over simplified, so it's all good.  What you suggested worked - I created those 3 fields and i see my payment date populated.

Still thinking and looking at this, but I'm still confused on how I populate Payment__c - for every claim, we have a "post payment" that is used.  I would think this would be populated when we post the payment...?

Thanks!
Kris
Photo of Kris

Kris

  • 574 Points 500 badge 2x thumb
So, both the claim and the payment are actually tied to the patient event, not the claim...which I guess is why this is happening.  I guess that means i have to approach this from the patient event, not the claim?  I had tried doing it this way at first, but couldn't get to the date that the claim was created.

What I'm wanting to show is the date the service was provided, how long it took us to file the claim and how long from when the claim was filed that it was paid....  so, i need the date of service from the patient event object, the date the claim was submitted from the claim object and the date it was paid from the payment object.   i think i'm confusing myself.  :-)

Can i do this?

Thanks!
Kris
Photo of Kris

Kris

  • 574 Points 500 badge 2x thumb
I have also given Skuid access to my org - if it would help, i'd be happy to send you my org id again.

I'm not sure how this will work or if i can do it, but in addition to the above, what i ultimately want to get to is an aggregate chart (which i'm still trying to understand) that shows the above 3 dates, along with the amount we billed and the amount that was paid.  
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Kris,

You need to decide what your data structure will look like. It sounds like you want one of these:

  1. Payment is a child of Claim is a child of Patient Event
  2. Payment is a child of Patient Event, Claim is a child of Patient Event.
Your decision is basically whether the Payment object should be directly related to Patient Event, or if it should be related to Claim, which is related to Patient Event.

Is a Payment always associated with a Claim? If so, I think you want #1.

In that scenario, to get your three date fields into your table on the Payment object you would need something like this:
Payment_Date__c, Claim__r.Claim_Date__c, Claim__r.Patient_Event__r.Date_of_Service__c

Is this making sense? Other suggestions, Pat?
Photo of Kris

Kris

  • 574 Points 500 badge 2x thumb
Thanks, Matt.  This does make sense.  Since my payment is really linked to my claim through the patient event, i think i have to go with #2 and try and figure out why i couldn't get my claim date before.  I think i was basically having same issue as the payment date, just with a different object.... :-(

I have struggled with understanding the difference between __r and __c too - i found that i think the __r is just a lookup vs. __c is any field that's not a lookup.  Is that right?

Thanks!
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Kris,

Help me understand a bit more so that I can steer you in the right direction...

Which is the case?
  1. There could be multiple Patient Events for one Claim
  2. There could be multiple Claims for one Patient Event
Photo of Kris

Kris

  • 574 Points 500 badge 2x thumb
Very good question - every claim only has 1 date of service, so 1 claim = 1 patient event....
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Ok. In that case, I would just make Claim and Patient Event the same object, but I'm sure there are reasons to separate them?

Either way, you want a lookup (or better yet, a master/detail) field on your Payment object, to relate it to the Claims object or Patient Event object.

One parent, many children. Your lookup field needs to go from child to parent.

The field you displayed in your original post has the relationship backwards... basically saying that you could have multiple Claims for one Payment.



If I understand it correction, you can think of the __r as 'reference.' It just means you're referencing a related object. The __c means 'custom\,' as in custom field or custom object.
Photo of Kris

Kris

  • 574 Points 500 badge 2x thumb
Yes, the claim and patient event objects need to be separate.  The claim is what pushes over to our clearinghouse to be processed.  The patient event is the parent for the details of the session - things like the payment made for the session, the claim info, therapists clinical notes....  the patient record is the parent of everything.

Very good info on child to parent - thanks for clarifying that because my natural thinking is parent to child, so it makes it confusing to not think of it the right way.  

The field in my original post that shows claims as the child relationship name, related to payment - that's the one that's backwards....got it.

Thanks for clarifying the __c and __r.  This makes sense too.  I have lots of custom fields, so this makes sense.

I think I understand what you're saying to do and will play with it and see what happens.

Thanks!
Kris
Photo of Kris

Kris

  • 574 Points 500 badge 2x thumb
Hi,

I am not able to create a master/detail field because this is a managed object, but I do have a master detail field on my payment object for the patient event:



I think I'm confused - you said my field in my original post is backwards, but that field is on the payments object.  If i create a lookup field on my payments object, how do i relate it to claims if it's not what i did in the original post?

For what I'm trying to do, are you saying i should be using the patient event object in my table?

Thanks for your help! 
Kris
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Ah, looks like I was the one who was confused. My apologies.

So, you have the relationship you need between Patient Event and Payment
Can you create a relationship between Patient Event and Claim?
Photo of Kris

Kris

  • 574 Points 500 badge 2x thumb
Create a relationship between patient event and claims on the patient event object?  I did that:


I can get to the claim now on my table and add the claim date, but it's not working to pull in that info and i'm seeing this error:
2. A Skuid Model, 'PatientEventSR', requested a Field with relationship name 'Payment__r.CreatedDate__r.CreatedDate', on the PPT2__Payments__c Object, but Skuid could not find a valid Field accessible through this relationship name. Please check that this Field actually exists on this Object (or on any related Objects). If it does not exist, remove it from this Model.

I'm sorry I'm so confused on how this should work.  Maybe i've been looking at it too long.  

Thanks for all your time and help!  I appreciate it!
Kris
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Kris,

#2 is easy. Look at your list of fields in the PatientEventSR model and remove the Payment__r.CreatedDate__r.CreatedDate field.
Photo of Kris

Kris

  • 574 Points 500 badge 2x thumb
OK - i deleted that field.  when i pasted it before, i was thinking it was my create date on my claim object.

My lookups (or i'm not getting the child/parent object stuff right) are still wrong though.  ;-(

This table is now using the patient events object.  The date of service and patient event num are on the patient events.  the next 6 fields are on the payments object (i.e. Payment__r.Insurance_Provider__c) and the created date is on the claims object (Claim__r.CreatedDate).  I'm not seeing the error for these fields that i last posted to you and am seeing the fields and object to select them, but it's still wrong since i'm not getting data.  



On the patient event object, i have the master / detail for payments (it's a managed field) and i created a lookup for the claims....

I should be using the patient events object, yes?  I think that's we agreed on above....

This shows my parent is patient event and my child is claim, right?  So, my lookup field is going from child to parent...




Thanks Matt!