web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Add date, time, second...
Power Apps
Unanswered

Add date, time, second and incremental "+1" to each filename.

(0) ShareShare
ReportReport
Posted on by 566

i am a beginner with formulas.

I have this code below:

 

Set(
 varSuccess;
 Blank()
);;
Clear(colFinalData);;
ForAll(
 galMetadata.AllItems;
 Collect(
 colFinalData;
 {
 Title: txtTitle.Text;
 Name: lblNameVal.Text;
 DataStream: imgDataStream.Image
 }
 )
);;
Set(
 varSuccess;
 'PowerApps-SendFilesWithMetadataToSharePoint'.Run(
 JSON(
 colFinalData;
 JSONFormat.IncludeBinaryData
 )
 ).success
);;
If(
 varSuccess="Yes";
 Clear(colFiles);;
 Notify(
 "Your files have been successfully upload to the data source";
 NotificationType.Success;
 3000
 );;
 Refresh(ListData);;
 Navigate(
 'Home Screen';
 ScreenTransition.CoverRight
 );
 Notify(
 "Error uploading files. Please try again or contact administrator";
 NotificationType.Error;
 3000
 )
)

 

 

i need to add the date,time,seconds and incremental "+1" to each filename "Title: txtTitle.Text;" please help me to rectify this formula. Thank you.

Categories:
  • Rajkumar_M Profile Picture
    3,747 Moderator on at

    Hi @Sormick 

     

    First, initialize your increment variable outside of your ForAll loop in App OnStart or Screen OnVisiable

     

    Set(varIncrement, 0);

    Then, inside your ForAll loop, increment the variable and add it to your title:

     

    ForAll( 
    galMetadata.AllItems;
    Set(varIncrement, varIncrement + 1);
    Collect( colFinalData;
    {
    Title: txtTitle.Text & Text(Now(), "[$-en-US] mm/dd/yyyy hh:mm:ss") & varIncrement;
    Name: lblNameVal.Text;
    DataStream: imgDataStream.Image }
    )
    );

     

     

    Thanks!

     

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

     

  • Rajkumar_M Profile Picture
    3,747 Moderator on at

    @Sormick Try this formula too,

     

    You can use the "mmddyyyyhhmmss" format to get the current date and time in the format MM-DD-YYYY-HH-MM-SS.

     

    Set(
    varSuccess;
    Blank()
    );;
    Clear(colFinalData);;
    Set(
    varIncrement;
    1
    );;
    ForAll(
    galMetadata.AllItems;
    Collect(
    colFinalData;
    {
    Title: txtTitle.Text & "_" & Text(Now(); "mmddyyyyhhmmss") & "_" & Text(Second(Now()); "00") & "_" & varIncrement;
    Name: lblNameVal.Text;
    DataStream: imgDataStream.Image
    }
    );
    Set(
    varIncrement;
    varIncrement + 1
    )
    );;
    Set(
    varSuccess;
    'PowerApps-SendFilesWithMetadataToSharePoint'.Run(
    JSON(
    colFinalData;
    JSONFormat.IncludeBinaryData
    )
    ).success
    );;
    If(
    varSuccess="Yes";
    Clear(colFiles);;
    Notify(
    "Your files have been successfully upload to the data source";
    NotificationType.Success;
    3000
    );;
    Refresh(ListData);;
    Navigate(
    'Home Screen';
    ScreenTransition.CoverRight
    );
    Notify(
    "Error uploading files. Please try again or contact administrator";
    NotificationType.Error;
    3000
    )
    )

     

     

     

    Thanks!

     

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

     

  • Sormick Profile Picture
    566 on at

    Unfortunately i'm using a french version of Power apps and the french formulas are slightly different from english.

    When i copy-Paste the formulas above it gives me multiple errors. It seems that formulas like set formulas below.

    But i don't know what ar other changes , so i'm stuck at the moment.

    Set(varIncrement, varIncrement + 1); 

    should be instead
    Set(varIncrement, varIncrement + 1);; 
    Set(varIncrement;

     

  • Sormick Profile Picture
    566 on at

    May i also ask you if there is a tool to translate power Fx formulas from English to French?

  • Rajkumar_M Profile Picture
    3,747 Moderator on at

    Currently, there is no specific tool to directly translate Power Fx formulas from English to French within Power Apps. However, you can use the Microsoft Translator connector in Power Apps to translate text on demand.

     

    Refer this link :  Connect to Microsoft Translator from Power Apps - Power Apps | Microsoft Learn

    Language function - Power Platform | Microsoft Learn

     

     

    Thanks!

     

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

  • Rajkumar_M Profile Picture
    3,747 Moderator on at

    You can use ; (Semi-Colon) instead of , comma.

     

    Set(varIncrement; varIncrement + 1); 
  • Sormick Profile Picture
    566 on at

    Hi Rajkumar_404, your formula above gives me an error: only with this: 

    Set(
    varIncrement;
    varIncrement + 1
    )

     If a remove this i get no error but by increment value dans not work. Please find the formula without errors but also without the varincrement

     

    Set(
    varSuccess;
    Blank()
    );;
    Clear(colFinalData);;
    Set(varIncrement;1);;
    ForAll(
    galMetadata.AllItems;
    Collect(
    colFinalData;
    {
    Title: txtTitle.Text & "_" & Text(Now(); "ddmmyyyyhhmmss") & "_" & Text(Second(Now()); "00") & "_" & varIncrement;
    Name: lblNameVal.Text;
    DataStream: imgDataStream.Image
    }
    )
    );;

    Set(
    varSuccess;
    'PowerApps-SendFilesWithMetadataToSharePoint'.Run(
    JSON(
    colFinalData;
    JSONFormat.IncludeBinaryData
    )
    ).success
    );;
    If(
    varSuccess="Yes";
    Clear(colFiles);;
    Notify(
    "Your files have been successfully upload to the data source";
    NotificationType.Success;
    3000
    );;
    Refresh(ListData);;
    Navigate(
    'Home Screen-2';
    ScreenTransition.CoverRight
    );
    Notify(
    "Error uploading files. Please try again or contact administrator";
    NotificationType.Error;
    3000
    )
    )

     

     

    Please help me to add the encrement code without causing errors

  • Rajkumar_M Profile Picture
    3,747 Moderator on at

    Try this 

     

    Clear(colFinalData); 
    Set(varIncrement;1);
    ForAll( galMetadata.AllItems;
    Collect(
    colFinalData;
    {
    Title: txtTitle.Text & "_" & Text(Now(); "ddmmyyyyhhmmss") & "_" & Text(Second(Now()); "00") & "_" & varIncrement;
    Name: lblNameVal.Text;
    DataStream: imgDataStream.Image }
    ) );
    UpdateContext( varIncrement; varIncrement + 1 );
    Set( varSuccess;
    'PowerApps-SendFilesWithMetadataToSharePoint'.Run( JSON( colFinalData; JSONFormat.IncludeBinaryData ) ).success );
    If(
    varSuccess="Yes";
    Clear(colFiles);
    Notify( "Your files have been successfully uploaded to the data source"; NotificationType.Success; 3000 );
    Refresh(ListData); Navigate( 'Home Screen-2'; ScreenTransition.CoverRight ) );
    Notify( "Error uploading files. Please try again or contact administrator";
    NotificationType.Error; 3000
    )
  • Sormick Profile Picture
    566 on at

    I have a error after:

    ForAll(
    galMetadata.AllItems;
    Collect(
    colFinalData;
    {
    Title: txtTitle.Text;
    Name: lblNameVal.Text;
    DataStream: imgDataStream.Image
    }
    )
    );;

    This code gives me an error:

    UpdateContext( varIncrement; varIncrement + 1 );;

    Error message:

    number of invalid arguments. 2 were received one was expected

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 130

Last 30 days Overall leaderboard