cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PowerAGuy
Helper IV
Helper IV

View a submitted record with the time

Hello,

 

I had thought this would work....

 

I have a simple app - when a user navigates back to a submitted record I am using the same screen as they would use if they were submitting a new record.

I have a date and time field. In the new record I am auto populating the date and time  using the following:

DefaultDate: If(!IsBlank(vRecord.'Date&Time'), Parent.Default,
Today())

 

The above works

But I cannot get the time to pick up the old data when vRecord is selected:

If(!IsBlank(vRecord.'Date&Time'), Parent.Default,
Text(Hour(Now()),"[$-en-US]00"))

 

1 ACCEPTED SOLUTION

Accepted Solutions

@PowerAGuy ,

Try

If(
   Form1.Mode = FormMode.New,
   Text(
      Hour(Now()),"[$-en-US]00"
   ),
   Text(
      Hour(Parent.Default),"[$-en-US]00"
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

7 REPLIES 7
WarrenBelz
Super User
Super User

Hi @PowerAGuy ,

I am not sure why that is not working, but if you want to show the current hour when entering a new record, you might try this

If(
   YourFormName.Mode = FormMode.New,
   Text(
      Hour(Now()),"[$-en-US]00"
   ),
   Parent.Default,
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @WarrenBelz 

Afraid I get the same behavior as my code, the default is set to 00 both for a new item and for a previously submitted item:

 

PowerAGuy_0-1615203525331.png

How do I check if my form mode is new - the options when added a form was "edit" or "display"?

@PowerAGuy ,

I was assuming you were setting it 

NewForm(YourFormName)

You posted this using the same screen as they would use if they were submitting a new record.

That syntax will certainly work on a new form - I use it regularly.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

@WarrenBelz 
I haven't designed my previous forms like this but I've added the new form code on my + button NewForm(Form1);
 and your code now works for a new form

I cannot get the submitted time to display on a previously submitted form though, that displays as 00

@PowerAGuy ,

Try

If(
   Form1.Mode = FormMode.New,
   Text(
      Hour(Now()),"[$-en-US]00"
   ),
   Text(
      Hour(Parent.Default),"[$-en-US]00"
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

@WarrenBelz 

 

Nope still no change.... as mentioned this works on the date field without any issues, which in SP is a date and time field, but I think PowerApps does not recognize the time field as a separate field? 

RandyHayes
Super User
Super User

@PowerAGuy 

Also consider for your DefaultDate property:  

Coalesce(Parent.Default, vRecord.'Date&Time')

 And your other formula as:

Text(Coalesce(Parent.Default, Hour(Now())), "00")
_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (5,178)