cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ramole
Post Prodigy
Post Prodigy

Dates

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

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also close the item., please consider giving it Thumbs Up.
1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

8 REPLIES 8
v-bofeng-msft
Community Support
Community Support

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

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

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also close the item., please consider giving it Thumbs Up.

Hi @Ramole 

please try 

DataCardValue8.SelectedText.Value

instead of 

DataCardValue8.Selected.Value

Best Regards,

Bof

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

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also close the item., please consider giving it Thumbs Up.

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

Hi @v-bofeng-msft 

 

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

Thanks 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also close the item., please consider giving it Thumbs Up.

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

View solution in original post

Thank you so much @v-bofeng-msft 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also close the item., please consider giving it Thumbs Up.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (83,090)