Skip to main content
Navigator | Tier 3
February 2, 2022
Question

Unable to use variable when connecting to database

  • February 2, 2022
  • 6 replies
  • 79 views

it seems I am unable to include variables (red box) while connecting to a database within a loop. Anyone have a work around?

 

SQL Loop 

msg box file path displayed below

 

FILE PATH DISPLAY

    6 replies

    Ashwin A.K
    Navigator | Tier 3
    February 2, 2022

    Hi @Steven chev​ ,

     

    Could you try displaying that filepath in a message box, just to see if there are any issues with it?

     

    Kind Regards,

    Ashwin A.K

    Blogs at TheCodingTheory - https://www.thecodingtheory.com
    Most Valuable Pathfinder
    February 2, 2022

    Hi @Steven chev​ ,

     

    We can use the variables, as Ashwin suggested can you check the path in a message box and let us know the result?

    Chand
    steveccAuthor
    Navigator | Tier 3
    February 2, 2022

    Hi @ChanduMohammad S​ 

     

    Thanks for chiming in. I have uploaded the results in the post above.

    steveccAuthor
    Navigator | Tier 3
    February 2, 2022

    Hi @Ashwin A.K​ 

     

    Thank you for you response.

     

    I have uploaded the photo of the message box to this thread

     

    It looks only 1/3 of the variables are displayed in the msg box. The $Filename$.$Extension$ are the two that are not displayed.

     

    Any suggestions?

     

    msg box 

    see below of error message when running line 2

     

    error msg

    Ashwin A.K
    Navigator | Tier 3
    February 3, 2022

    Hi @Steven chev​ ,

     

    Could you verify whether the folder which you are iterating through contains files other that the excel files you wish to interact with?

     

    Try this, add an If Command and only connect to Excel if the $Extension$ = xlsx.

    That ought to do the trick.

     

    Kind Regards,

    Ashwin A.K

    Blogs at TheCodingTheory - https://www.thecodingtheory.com
    Most Valuable Pathfinder
    February 3, 2022

    Hi @Steven chev​ ,

     

    This is the issue, check why the values are not getting passed correctly to this variable you will get connected to the Database.

    Chand