Hi,
I'm new to Power Apps and am running up against some challenges. Coming from a programming background with a lot of work using Entity Framework has, I think, polluted my thinking in how to work with Entities in CDS/Power Apps.
Is it possible for a child entity to retrieve a field value from a parent entity to perform a calculation in a model-driven app? Here's a scenario:
- A Quote entity contains a field "Effective Date"
- An Insured entity contains a field "Premium"
- There is a one to many relationship between Quote and Insured entities.
- When adding/editing an Insured to a Quote via a Quick Create or Main form I need to calculate a value for the Insured's "Premium".
- The formula to calculate the Insured's "Premium" value requires the variable "Effective Date" from the parent Quote entity.
- The Premium value should display immediately in the client when editing/adding and Insured. A user should not be required to save before the value calculates and displays in the form.
I am at a loss as to how to calculate the value for an Insured's Premium. I like the interface of a Quick Create form in the model driven app but I'm not sure this is the correct approach. I don't see how one could lookup the Quote's "Effective Date" value via a client script as the script's scope is limited to the the form fields. I don't want my users to have to re-enter an effective date for each insured just so the calculation can work properly.
I have several scenarios where a calculation for a field in a child entity requires some variable defined at the parent entity's level. Perhaps using main/quick create forms in the model-driven app isn't the right approach? Maybe embedding a canvas app within the model driven app is a better alternative? In a canvas app could I add child entities to a Quote and perform the various calculations that require some of the parent field values?
Thanks in advance for any help. I'm sure I'll be back with more questions as I get deeper into this new-to-me platform.
Thanks,
Dan