KAPOW

Would you like to react to this message? Create an account in a few clicks or log in to continue.
KAPOW

Welcome to the Kapow forum. Here you can get help, use your skills to help others and enjoy hanging out in the company of other Kapow Robot Developers.


2 posters

    [Solved]Write SQL query result in a text file

    avatar
    victorg89


    Posts : 10
    Points : 1835
    Join date : 2019-05-09

    [Solved]Write SQL query result in a text file  Empty [Solved]Write SQL query result in a text file

    Post by victorg89 Thu Oct 31, 2019 2:25 am

    Hello guys,

    I need some help to write a file with my variables.

    I'm running a query database, returning the values and i need to write the query result in a text file.

    But the Step "Query Database" brings me a line for each run, is there any way to run the query and get the result as a single file?

    Second point, i created a step "Write File" but this step in not helping me because it only write a variable per time. If i could stract the Query result as a single variable and not each collumn\line per time it would help a lot.


    Last edited by victorg89 on Sat Nov 02, 2019 3:04 am; edited 1 time in total
    avatar
    Sie


    Posts : 5
    Points : 1648
    Join date : 2019-11-01
    Location : SA

    [Solved]Write SQL query result in a text file  Empty Re: [Solved]Write SQL query result in a text file

    Post by Sie Fri Nov 01, 2019 5:57 pm

    I am experiencing the same issue
    avatar
    victorg89


    Posts : 10
    Points : 1835
    Join date : 2019-05-09

    [Solved]Write SQL query result in a text file  Empty Re: [Solved]Write SQL query result in a text file

    Post by victorg89 Sat Nov 02, 2019 2:20 am

    I'm using the step "Write File", but i only can write one variable.

    At the window "File Content" i choose the option "Expression" and added one of my variables.
    Marked the box "Append to File" and all the lines were written.

    My problem is that i can't write 2 or more variables.

    I've tried the following expressions:
    "variable1" + "variable2" + "variable3" 
    variable1 ++ variable2 ++ variable3
    "variable1;variable2;variable3"

    But i got no success
    avatar
    victorg89


    Posts : 10
    Points : 1835
    Join date : 2019-05-09

    [Solved]Write SQL query result in a text file  Empty Re: [Solved]Write SQL query result in a text file

    Post by victorg89 Sat Nov 02, 2019 2:38 am

    Solved.

    the right expression is: variable1 + " " + variable2 + " " variable3
    avatar
    Sie


    Posts : 5
    Points : 1648
    Join date : 2019-11-01
    Location : SA

    [Solved]Write SQL query result in a text file  Empty Re: [Solved]Write SQL query result in a text file

    Post by Sie Mon Nov 04, 2019 4:52 pm

    Hi i am still new in Kapow,please advise which varialbes are you reffering to?

    Are you talking about my input/out put variables. If possible could you please explain using example.
    avatar
    victorg89


    Posts : 10
    Points : 1835
    Join date : 2019-05-09

    [Solved]Write SQL query result in a text file  Empty Re: [Solved]Write SQL query result in a text file

    Post by victorg89 Mon Nov 04, 2019 7:55 pm

    I created a "Type" containing all my database collumns, in the robot i created a variable named "return" and there i've set the "Type".
    After the step "Query Database" you need to put a return step, in this step you set return to the variable "Return", after this you put a step "Write File" and at the File Content you input your variables or waht you need to write.
    avatar
    Sie


    Posts : 5
    Points : 1648
    Join date : 2019-11-01
    Location : SA

    [Solved]Write SQL query result in a text file  Empty Re: [Solved]Write SQL query result in a text file

    Post by Sie Mon Nov 04, 2019 9:17 pm

    Hi I dd that but still experiencing the same issue, below please see the flow of my robot and the explanations

    Robot:
    [Solved]Write SQL query result in a text file  OAAAAAElFTkSuQmCC

    Explanations:
    I created  another robot separately for storing data in  DB, four rows have been stored in DB, as they are on excel sheet, all values are returned as Output(returned Values) but it writes only one row in the file
    Variables: I created Variable(Ex2) of simple excel for setting up the content of the cells(Headers)
    When configuring "Write file step" I used Ex2 variable in the file  content 

    SQL  Query i used is :"SELECT * FROM TableName". I Want to write all values stored in my DB

    Thanks in advance.

    Sponsored content


    [Solved]Write SQL query result in a text file  Empty Re: [Solved]Write SQL query result in a text file

    Post by Sponsored content


      Current date/time is Sun Apr 28, 2024 3:36 pm