Variable that combines string and date doesn't show consistently

Hi. I’m having some issues with variables combining string and date.

Defined Variables:

  1. Trx_Recon_Date: DateTime variable to be input through Input dialog and used as part of a file name which is defined in a variable.
  2. CamboPay_Report_Location: String variable (Default: “D:\Mobile Top Ups\Reconciliation Automation\CamboPay\CamboPay Report on -” + Trx_Recon_Date.ToString(“dd-MMM-yy”) + “.xlsx”).

The series of activities that I’m having are:

  1. Input dialog (Input date of transaction) => Saved as Trx_Recon_Date. When de-bugging, I typed 6/20/2022
  2. MsgBox: Trx_Recon_Date.ToString(“dd-MMM-yy”) => When de-bugging, the MsgBox displayed “20-Jun-22”
  3. MsgBox: CamboPay_Report_Location => When de-bugging, the MsgBox displayed “D:\Mobile Top Ups\Reconciliation Automation\CamboPay\CamboPay Report on -01-Jan-01.xlsx”

Please help to look into this because the expected CamboPay_Report_Location output should be: “D:\Mobile Top Ups\Reconciliation Automation\CamboPay\CamboPay Report on -20-Jun-01.xlsx”

Thank you.

Regards,
Alex

Hi,

Can you try to set content of CamboPay_Report_Location variable using Assign activity , just before the above step3?

CamboPay_Report_Location = "D:\Mobile Top Ups\Reconciliation Automation\CamboPay\CamboPay Report on -" + Trx_Recon_Date.ToString("dd-MMM-yy") + ".xlsx"

Regards,

Hi!

Try Like this:

Assign CamboPay_Report_Location = "D:\Mobile Top Ups\Reconciliation Automation\CamboPay\CamboPay "+"Report on -"+Trx_Recon_Date.ToString("dd-MMM-yy")+".xlsx"

Regards,
NaNi

The solution works now. Thank you very much.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.