cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
patgat96
Frequent Visitor

Submit datepicker as metadata to document library

I currently have trouble with something VERY similar if not entirely like this post:

https://powerusers.microsoft.com/t5/Building-Power-Apps/SUBMIT-DATE-PICKER-DATE-TO-SHAREPOINT-FORMUL...

 

However, if you read one of my recent comments ( I don't think this user is active anymore ), you'll note that I either don't know how to implement this correctly, or I'm fudging the flow/powerapps formula.

 

I googled and copied:

formatdatetime(triggerBody()['Updatefileproperties_EndDate'],'mm/dd/yyyy')
 
When it comes to my formula for PowerApps, I have managed to get it to work with almost all other data types to include a people picker, but I can't get it to work with the date picker. The formula I'm using is:
 

Set(varDemoFromAttachmentControl, JSON(Image1.Image, JSONFormat.IncludeBinaryData));
Set(varBase64Only, Mid(varDemoFromAttachmentControl, Find(",", varDemoFromAttachmentControl)+1, Len(varDemoFromAttachmentControl) - Find(",", varDemoFromAttachmentControl)-1 ));

Set(varFileLink, 'EasyUpload'.Run(Last(AttachmentControl.Attachments).Name, varBase64Only, DataCardValue7.SelectedDate).sharepointfilelink);

 

This entire formula was taken by Shane Young on his video: https://www.youtube.com/watch?v=3QaiM8SeWfM&t=0s

 

Can someone point me in the right direction?

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @patgat96 ,

To things here - firstly the parameter for your date needs to be

Text(DataCardValue7.SelectedDate,"mm/dd/yyyy")

and then in your Flow, you need to put it back to a Date - example below I just tested and it worked fine.

WarrenBelz_0-1659646319563.png

Also a bit of optimising of your code to avoid leaving Variables "hanging around"

With(
   {
      wJSON: 
      With(
         {
            wJSONI: 
            JSON(
               Image1.Image,
               JSONFormat.IncludeBinaryData
            )
         },
         Mid(
            wJSONI,
            Find(
                 ",",
               wJSONI
            ) + 1,
            Len(wJSONI) - 
            Find(
               ",",
               wJSONI
            ) - 1
         )
      )
   },
   Set(
      varFileLink, 
	  'EasyUpload'.Run(
         Last(AttachmentControl.Attachments).Name, 
         wJSON, 
         Text(DataCardValue7.SelectedDate,"mm/dd/yyyy")
      ).sharepointfilelink
   )
);

 

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.

Visit my blog Practical Power Apps

 

 

 

View solution in original post

3 REPLIES 3
WarrenBelz
Super User
Super User

Hi @patgat96 ,

To things here - firstly the parameter for your date needs to be

Text(DataCardValue7.SelectedDate,"mm/dd/yyyy")

and then in your Flow, you need to put it back to a Date - example below I just tested and it worked fine.

WarrenBelz_0-1659646319563.png

Also a bit of optimising of your code to avoid leaving Variables "hanging around"

With(
   {
      wJSON: 
      With(
         {
            wJSONI: 
            JSON(
               Image1.Image,
               JSONFormat.IncludeBinaryData
            )
         },
         Mid(
            wJSONI,
            Find(
                 ",",
               wJSONI
            ) + 1,
            Len(wJSONI) - 
            Find(
               ",",
               wJSONI
            ) - 1
         )
      )
   },
   Set(
      varFileLink, 
	  'EasyUpload'.Run(
         Last(AttachmentControl.Attachments).Name, 
         wJSON, 
         Text(DataCardValue7.SelectedDate,"mm/dd/yyyy")
      ).sharepointfilelink
   )
);

 

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.

Visit my blog Practical Power Apps

 

 

 

I'm running into a problem in the flow. Whenever I try to make the "create item" option, I cannot choose the document library. I'm not sure if this is because I've already called it once for the "create file" section or if it's because it's a document library and not a list.

Hi @patgat96 ,

You need Create file for a Library (not Create item) - just add the date into the field in there.

 

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.

Visit my blog Practical Power Apps

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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