Jump to content
Labtechuser1

Looping File Write Function wrt SQL Query results

Recommended Posts

Hi

 

I am writing a script that queries the database, gets all the disabled monitors, write them to a text file and raise a ticket with the results . Problem I am facing is for every loop my Write to File function overwrites the text already written in the text file. Can anyone please suggest if there is a workaround for this problem

Also any alternative way to achieve this (other than scripting).

 

Thanks in advance

Share this post


Link to post
Share on other sites

The only way i was able to do something like this is run a set variable on the current txt file content then use that variable along with the new txt to be added.

Share this post


Link to post
Share on other sites
On 12/13/2016 at 12:15 AM, Labtechuser1 said:

Hey thank you for your time. I found an alternative. Instead of writing to text file I did Shell Echo to a file. It worked simply perfect.

How ? Can you please let me know as well. i also need this function. 

Share this post


Link to post
Share on other sites
18 hours ago, DarrenWhite99 said:

Assuming it is only 1 line:

Shell: echo -@variable@ >> LocalLogfile.txt

Thanks Darren it worked. Can you let me know one more thing if possible . how we can export ping result into text file from labtech script .  I am trying to use "ping ipaddress >>path" but it is not working. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×