How to pass values in config file in uipath

iam using Join pdf activity where in files list aim passing {“C\Automation\Temp\1.pdf”,“C\Automation\Temp\2.pdf”,“C\Automation\Temp\3.pdf”}

how can i add this in config file

here iam iam Joining 3 pdf files

Just put it in the config file this way:

C:\Automation\Temp\1.pdf,C:\Automation\Temp\2.pdf,C:\Automation\Temp\3.pdf

Then after reading the config file you can convert that to an array (with Split) or whatever you need.

Hi @T_Y_Raju

Update your Config file (usually an Excel file named Config.xlsx) to include the paths to your PDF files. Add a new key in the Settings sheet for the list of PDF

Name Value
PdfFiles C:\Automation\Temp\1.pdf,C:\Automation\Temp\2.pdf,C:\Automation\Temp\3.pdf
1. Excel Application Scope
    - WorkbookPath: "path\to\Config.xlsx"
    - Output: workbook

    2. Read Range
        - SheetName: "Settings"
        - Output: dt_Config

3. For Each Row
    - Input: dt_Config
    - Output: row

    4. If (row("Name").ToString = "PdfFiles")
        - Then:
            5. Assign (pdfFilesString = row("Value").ToString)
            6. Assign (pdfFilesArray = pdfFilesString.Split(","c))
            
            7. Join PDF Files
                - Files: pdfFilesArray
                - Output: "path\to\output\Joined.pdf"

Hope it helps!!

Hi @T_Y_Raju

Add like below in the Config File

Name                Value
PDFFileList         C\Automation\Temp\1.pdf,C\Automation\Temp\2.pdf,C\Automation\Temp\3.pdf

Use the below Assign activity to read it from Config file:

pdfFileArray = Config("PDFFileList").ToString.Split({","}, StringSplitOptions.RemoveEmptyEntries)

pdfFileArray is of DataType Array(System.String)

Use Join PDF Files Activity and pass pdfFileArray as Input Array and in Output you can give the required PDF output name.

Hope it helps!!

here iam taking the output of Join PDF as FinalFileNam whcih iam passing that value in type into activity

why should i convert to Array?

I mentioned converting to array because that’s what this is:

{“C\Automation\Temp\1.pdf”,“C\Automation\Temp\2.pdf”,“C\Automation\Temp\3.pdf”}

could you please let me know how this will work
Config(“PDFFileList”).ToString.Split({“,”}, StringSplitOptions.RemoveEmptyEntries

will this split each pdf file into separate PDF

Hi @T_Y_Raju

=> The first step is that you add the paths of PDF files seperated by , in Config File.

=> The Assign activity explains the below steps:

  • Config("PDFFileList"): Retrieves the value associated with the key PDFFileList from the Config dictionary.
  • .ToString: Converts the retrieved value to a string. This ensures that even if the value is stored in a different format, it is converted to a string for further processing.
  • .Split({","}, StringSplitOptions.RemoveEmptyEntries): Splits the string into an array of substrings using the comma (,) as the delimiter.
  • StringSplitOptions.RemoveEmptyEntries removes any empty entries from the resulting array.

=> the output datatype is Array(System.String) i.e pdfFileArray

Now, you can use pdfFileArray as input in Join PDF file activity.

Hope you understand!!

@T_Y_Raju,

Put this in Config

C:\Automation\Temp\1.pdf,C:\Automation\Temp\2.pdf,C:\Automation\Temp\3.pdf

Split it like this in code to store it in an array.

arrPdfPath = Config(“PDFFileList”).ToString.Split({“,”}, StringSplitOptions.RemoveEmptyEntries)

No you can pass arrPdfPath to join PDF activity.

Thanks,
Ashok :slight_smile:

No, that turns the comma delimited string into an array. If you want to split a PDF into multiple PDFs you use the Extract PDF Page Range activity.