web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Apps
Answered

Dates

(0) ShareShare
ReportReport
Posted on by Super User 2024 Season 1

Hi All,

 

I wonder if this is possible i have a form and Repeating gallery all i need is when payment frequency dropdown is select monthly the repeating gallery should auto calculate and create 4 lines filled due dates for me at moment i am using this formula and it does creates for me lines :

Could you please try this?

 

1. Set App.OnStart: ClearCollect(ColNum,[1,2,3,4,5,6,7,8,9,10]) 

2. Modify the OnChange of Number Package Textinput box as below, it creates new rows repeatedly based on the values you enter.

 

ForAll(
FirstN(ColNum,Value(DataCardValue60_2.Text)),
Collect( NewShipCollection,
{CItemSerialNumber: Text(Last(NewShipCollection).CItemSerialNumber + 1),
Clevel: "",
Ctc: "",
Cdescription: ""
}))

 

also screenshot 

 

date set.pngpay.png

Categories:
I have the same question (0)
  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Ramole :

    The point is using switch function.

    I've made a test for your reference:

    1\Add a data picker control(DatePicker1)

    2\Add a drop down control(Dropdown1)

    Items:

     

    ["Weekly","Monthly","Daily","Annual"]

     

    3\Set the DataCardValue60_2's OnChange porperty to:

     

    ForAll(
     FirstN(
     ColNum,
     Value(DataCardValue60_2.Text)
     ),
     Collect(
     NewShipCollection,
     {
     CItemSerialNumber: Text(Last(NewShipCollection).CItemSerialNumber + 1),
     'Due Date': Switch(
     Dropdown1.SelectedText.Value,
     "Weekly",
     DateAdd(
     DatePicker1.SelectedDate,
     Value(Last(NewShipCollection).CItemSerialNumber + 0) * 7,
     Days
     ),
     "Daily",
     DateAdd(
     DatePicker1.SelectedDate,
     Value(Last(NewShipCollection).CItemSerialNumber + 0),
     Days
     ),
     "Monthly",
     DateAdd(
     DatePicker1.SelectedDate,
     Value(Last(NewShipCollection).CItemSerialNumber + 0),
     Months
     ),
     "Annual",
     DateAdd(
     DatePicker1.SelectedDate,
     Value(Last(NewShipCollection).CItemSerialNumber + 0),
     Years
     )
     ),
     Clevel: "",
     Ctc: "",
     Cdescription: ""
     }
     )
    )

     

    9.gif

    Best Regards,

    Bof

  • Ramole Profile Picture
    Super User 2024 Season 1 on at

    Hi @v-bofeng-msft 

     

    I have tried the code but i get blank on the gallery when i select the dates and payment frequency and number loan dropdown the on change code is on the number of loans dropdown as it collections but the gallery returns blank, here the code which i have modified a bit 

     


    ForAll(
    FirstN(
    ColNum,
    Value(DataCardValue45.Selected.Value)
    ),
    Collect(
    NewLoansCollection,
    {
    CItemSerialNumber: Text(Last(NewLoansCollection).CItemSerialNumber + 1),
    LoanDueDate: Switch(
    DataCardValue8.Selected.Value,
    "Weekly",
    DateAdd(
    DatePicker3.SelectedDate,
    Value(Last(NewLoansCollection).CItemSerialNumber + 0) * 7,
    Days
    ),
    "Daily",
    DateAdd(
    DatePicker3.SelectedDate,
    Value(Last(NewLoansCollection).CItemSerialNumber + 0),
    Days
    ),
    "Monthly",
    DateAdd(
    DatePicker3.SelectedDate,
    Value(Last(NewLoansCollection).CItemSerialNumber + 0),
    Months
    ),
    "Annual",
    DateAdd(
    DatePicker3.SelectedDate,
    Value(Last(NewLoansCollection).CItemSerialNumber + 0),
    Years
    )
    ),
    Clevel: "",
    Ctc: "",
    Cdescription: ""
    }
    )
    )

     


    ;Set(HideForm4,true);Set(HideForm3,false)

     

     

    wrong.pngblanket.png

  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Ramole 

    please try 

    DataCardValue8.SelectedText.Value

    instead of 

    DataCardValue8.Selected.Value

    Best Regards,

    Bof

  • Ramole Profile Picture
    Super User 2024 Season 1 on at

    Hi @v-bofeng-msft 

     

    Thanks it was ColNum wrong, the correct one was ColNumb, that solved, can the switch handle calculation ? example if the loan amount is $2000 and i select dropdown monthly and numbers of months is 4 can it auto calculate and fill amount field like $500 each month depending how months i select? if yes please help me with formula.

     

    Thank you so much.

     

    due.png

    amount.png

  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Ramole :

    Can you describe your calculation logic in detail? I don’t quite understand. If the total loan is 1,000 and it will be changed in 4 months, why is it 500 per month?

    Best Regards,

    Bof

  • Ramole Profile Picture
    Super User 2024 Season 1 on at

    Hi @v-bofeng-msft 

     

    Sorry i was wrong i mean $2000, i have edited the post.

    Thanks 

  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Ramole :

    1\Add a text input control(TextInput1)

    2\Then try this code:

    ForAll(
        FirstN(
            ColNum,
            Value(DataCardValue60_2.Text)
        ),
        Collect(
            NewShipCollection,
            {
                CItemSerialNumber: Text(Last(NewShipCollection).CItemSerialNumber + 1),
                'Due Date': Switch(
                    Dropdown1.SelectedText.Value,
                    "Weekly",
                    DateAdd(
                        DatePicker1.SelectedDate,
                        Value(Last(NewShipCollection).CItemSerialNumber + 0) * 7,
                        Days
                    ),
                    "Daily",
                    DateAdd(
                        DatePicker1.SelectedDate,
                        Value(Last(NewShipCollection).CItemSerialNumber + 0),
                        Days
                    ),
                    "Monthly",
                    DateAdd(
                        DatePicker1.SelectedDate,
                        Value(Last(NewShipCollection).CItemSerialNumber + 0),
                        Months
                    ),
                    "Annual",
                    DateAdd(
                        DatePicker1.SelectedDate,
                        Value(Last(NewShipCollection).CItemSerialNumber + 0),
                        Years
                    )
                ),
                Clevel: "",
                Ctc: "",
                Cdescription: "",
                'loan amount': Value(TextInput1.Text) / Value(DataCardValue60_2.Text)
            }
        )
    )

    11.gif

    Best Regards,

    Bof

  • Ramole Profile Picture
    Super User 2024 Season 1 on at

    Thank you so much @v-bofeng-msft 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 379 Most Valuable Professional

#2
11manish Profile Picture

11manish 203 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard