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

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.

 

View solution in original post

@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.
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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,221)