Hi guys,
My app is to ask people fill in the report daily or monthly, and data has been connected to sql server.
When someone choose the service name, it will automatically show this is a daily or monthly report.
My problem is that if this a monthly report, how can I display a drop down menu showing just past three months from now to let people choose one.
Plus, if this a daily report, how can I display a drop down menu showing only past two weeks date from now.
Please help me. Thank you very much.
Solved! Go to Solution.
No worries! More than half the challenge in developing apps is deciding/designing them.
Here's updated code for all the days:
With(
{
varToday: Today(),
varWeeks: 4 * 7
},
ForAll(
Sequence(varWeeks),
{
tblDate: Text(
DateAdd(
varToday,
(ThisRecord.Value - varWeeks + 7),
Days
),
DateTimeFormat.ShortDate
)
}
)
)
Here's updated code for a 5-month range, with 2 months before this month, and 2 after.
With(
{
varStartDate: DateAdd(
Today(),
-3,
Months
),
varMonths: 5
},
ForAll(
Sequence(varMonths),
{
tblDate: Text(
DateAdd(
varStartDate,
ThisRecord.Value,
Months
),
"[$-en-US]mmm yyyy"
)
}
)
)
Something like this will give you three rows (this week, and two weeks prior). You can tweak the Text formatting, to adjust how it shows up.
With(
{
varToday: Today(),
varWeeks: 3
},
ForAll(
Sequence(varWeeks),
{
tblDate: Text(
DateAdd(
varToday,
(ThisRecord.Value - varWeeks) * 7,
Days
),
DateTimeFormat.ShortDate
)
}
)
)
Something like this will give you the last three months, including the current.
With(
{
varToday: Today(),
varMonths: 3
},
ForAll(
Sequence(varMonths),
{
tblDate: Text(
DateAdd(
varToday,
(ThisRecord.Value - varMonths),
Months
),
"mmm yyyy"
)
}
)
)
Thank you so so so much for your reply. It works! The only problem is that I'd like to show all the dates within three weeks (two past weeks from now and one future week ) not just three days. Sorry for my unclear explanation before.
Also, what if I want four months which are past two months from now, now and one month later.
Again, I really appreciate what you did because I am quite a new Power app learner.
No worries! More than half the challenge in developing apps is deciding/designing them.
Here's updated code for all the days:
With(
{
varToday: Today(),
varWeeks: 4 * 7
},
ForAll(
Sequence(varWeeks),
{
tblDate: Text(
DateAdd(
varToday,
(ThisRecord.Value - varWeeks + 7),
Days
),
DateTimeFormat.ShortDate
)
}
)
)
Here's updated code for a 5-month range, with 2 months before this month, and 2 after.
With(
{
varStartDate: DateAdd(
Today(),
-3,
Months
),
varMonths: 5
},
ForAll(
Sequence(varMonths),
{
tblDate: Text(
DateAdd(
varStartDate,
ThisRecord.Value,
Months
),
"[$-en-US]mmm yyyy"
)
}
)
)
It really helps. Thank you so much.
Just a quick question, how can I set a Blank item in that dropdown as Default since sometimes people just leave the first date showing in the menu and forget to select one.
User | Count |
---|---|
184 | |
123 | |
90 | |
46 | |
42 |
User | Count |
---|---|
267 | |
160 | |
129 | |
81 | |
76 |