Append a textbox while processes are happening

Hi,

I'm trying to find a way to append a textbox that's displayed on screen as some queries/tasks are happening. Much like a log file. I've tried appending a text file by first grabbing it's contents then re-writing it back with some appended text, but it doesn't seem to work (my Javascript is basic, looks like it's not doing it in order??).

Is there anything that can resemble a log file that you just write to and can be displayed in a modal?

Cheers,
Dave.

Hi @Dave_Goodbourn,

Welcome.
This should be possible. It’s just a matter if continuously refreshing and writing data from/to a datasource. You can set sources to refresh every x seconds.
Where is your textfile stored and what have you tried so far?

Ah sorry my bad. There is no text file. In my app it runs a few queries then processes etc. This can take up to 15 seconds, so I want a display that says what it's doing. I was also looking at a progress bar, but want the text to display what it's found and what it's doing.

I only mentioned a log file as an example, as if I was tailing a log file, watching events coming in.

I can write to a textbox, but can't seem to append it.

As an example I'm simply trying

update_textbox.clearValue()

var textbox = ''
update_textbox.setValue('Starting things...)
  
<snip - do stuff>

textbox = update_textbox.value
update_textbox.setValue(textbox + '\nDoing more stuff...')

But the second setValue just seems to overwrite the first line.
If I run it again, the clearValue() also doesn't seem to work. It's probably my bad Javascipt.

This is being run in a Javascript Query.

OK I've got it to work. I just need to keep appending a variable that I then update the textbox with.

1 Like

You can write the data to a temporary state or store it on local storage and update that one by appending data. Then let the textbox read from that state. It should automatically update once the state’s data changes.

1 Like