Hi all,
I've a Principle and Interest generator. I give it the inputs and it generates a Principal and Interest Schedule. What I am trying to do is to have the subsequent records containing Principal and Interest update when I update the Principal amount of a certain record.
If anyone have any ideas of how to go about this it would be greatly appreciated.
These are the inputs:
The Output when a user presses "Generate":
This is the result when I update a certain record in gallery. But I would like all the following records to update too once I click the red "save" button. I haven't been able to come up with an idea that will update the subsequent records but preserve the preceding records. - Any advice would be welcome.
This the code I use to Patch my collection located in the red "save" button:
Patch(myCollection, Gallery5_1.Selected, {Int: Value(TextInput7_1.Text), Pik: Value(TextInput7_4.Text), Pri: Value(TextInput7.Text)});
This is the bulk of the code used to Generate the charts and gallery:
Set(
varSpinnerPrincipleandInterest,
true
);
//Logic for Principle and Cash interest calculator starts
If(
varRuns = 0,
Set(
varPri,
Value(
Text(
'Principle.txt'.Text,
"[$-en-US]###,###,###.00"
)
)
);
//Sets a variable for interest amount
Set(
varInt,
Value('Interest.txt'.Text) / 100 * varPri
);
//Sets a variable for PIK amount
Set(
varPIK,
Value('PIK.txt'.Text) / 100 * varPri
);
//Sets a variable for the start of the schedule
Set(
varDate,
StartDate.SelectedDate
);
//Sets a variable for the ID for each record
Set(
varID,
1
);
//Creates the table of the Principle and Interest Schedule
ClearCollect(
myCollection,
{
Period: varDate,
Pri: varPri,
Int: varInt,
Pik: varPIK,
ID: varID
}
);
,
//Adds a new record to the Principle and Interest Schedule based on the number of quarters (each quarter gets a record)
Patch(
myCollection,
Defaults(myCollection),
{
Period: varDate,
Int: varInt,
Pri: varPri,
Pik: varPIK,
ID: varID
}
);
Set(
varInt,
varInt
);
Set(
varPri,
varPri
);
Set(
varPIK,
varPIK
);
Set(
varDate,
varDate
);
Set(
varID,
varID
);
);
Set(
varPri,
varPri - varInt
);
Set(
varInt,
varPri * Value('Interest.txt'.Text) / 100
);
Set(
varPIK,
(varPri + varPIK) * Value('PIK.txt'.Text) / 100
);
Set(
varDate,
DateAdd(
varDate,
90
)
);
Set(
varID,
varID + 1
);
//Logic for Principle and Interest Schedule ends
UpdateContext({varRuns: varRuns + 1});
If(
varRuns >= varLoopEnd - 1,
UpdateContext({varTimerStart: false})
);
Many thanks,
Conor

Report
All responses (
Answers (