I want to ask you if is it possible to remove some rows automatically when a condition is valid. I have a column in my table where the time is displayed like this (HH:MM: 16:30, 18:45). I would like to compare this with windows actual time and after one hour let’s say to be automatically deleted. If windows time is 17:29 when it will be 17:30 it will automatically delete the row that has in the respectively column 16:30.
hmm if you mean like literally delete the row form the dataset then as far as I know, no.
It won’t be displayed with correct filter, but won’t be deleted (that you’d need to do manually)
I found a script to do this, or partially because it is not deleting the row but it is hiding it. The script is this:
$(‘tr:has(td:contains(“text”))’).hide()
When finds the “text” it hides the row that it contains it. If someone wants to use it, modify the modules\preview\HtmlTemplate.html and add this code at the javascript content.
My problem is that I want this to happen after a time of 30 seconds let’s say, the soft detects that the specific text was entered by the user in dataset, it waits 30 seconds and after that it hides the row. Another problem is that the table hides that row and instead of it will be the black screen that is specific of layout. I would like the table to remain at its size and all his properties, only the content from that row to be removed. Does someone know if can I do this? Thank you!
The ideea is that the “text” will not be in the dataset from the beginning. It will be entered manually by a user at a moment. The question is if that filter condition query the database regularly to see if something is changed in the content of cells. If it does, can I add a simple sql query syntax to remove the content of that row after 30 seconds when it detects that “text”?
The code goes fine, after 10 seconds it hides the row that I want, but the problem is that when client refresh the information that row appears again and after 10 seconds it hides. Do you have any ideea how can I resolve this? Could I remove the content of that row directly in database? Many thanks.
You’d need a column in the dataset that held the time the text was added. You can then define a filter that ignores rows that are older than 30 seconds ago.
That should work, but you’re constrained by the player collection interval - so you won’t be able to refresh much faster than every minute or so that way.
It’s ok, I can choose to ignore that row after 90 seconds and select the collection interval: 90 seconds. I understand that the admin has to manually introduce the time when he enter that “text”? Or the column that will held the time can be automatically updated with the time when admin only entered that text in database?
You can set it as a formula type and use NOW() function to enter the current date and time automatically (I think) although test that as it may be re-evaluated each time the dataset is read.
Otherwise yes you would need to have that entered manually.
I searched on google but I didn’t find something that can help me. From what I understand I need a script that I’ll put it on formula type of the column that has to enter the current date (NOW()) but to do this only when it detects that “text” from that column that is on the same row with it.
Can you give me an ideea or where do I have to look at?
You don’t need any script. You create a column called say TimeStamp and set it to type DATETIME and then make it a FORMULA and then enter the formula NOW()
That means every row will have a timestamp on it. Then you define a filter on the dataset view that checks for Text in the row and if the timestamp is within whatever range you want.
Ok, so anytime admin modifies something on that row, the value of the column “TimeStamp” will be updated. Is it possible to write a script that will detect if a “text” exists on that row and to hide/remove elements of that row after a period, let’s say something like the value from “TimeStamp” + 90 seconds?
I really can’t explain it any other way than I have already.
No script is required. Nothing clever. You simply put a filter on your dataset view, that says that it shows only items where the timestamp is less than 90 seconds old, and the text doesn’t contain “text”. Then only the rows you want will be shown. When the timestamp is more than 90 seconds old, then next layout refresh the rows will go away automatically.
I put that column with formula NOW() and it is modifying everytime when it makes a refresh and it is the same for all rows. I really don’t know how to write exactly in filter from datasetview to display that row that contains “text” only for 90 seconds. I would be grateful if you can help me. Thank you so much!
I replaced “where” with “AND” and no change, I saw in other examples posted here that worked with “AND”. Is it possible to do it in this way or to try something else?
Which means ColumnName isn’t exactly “Text” and the Timestamp is up to 90 seconds old. But if the Timestamp Column is always being update then it won’t work anyway. I don’t think Xibo can do what you want directly on that basis.
Maybe you’re right and I will think to do it in other way. But the problem at that syntax is that it blocks the layout. If I only write ColumnName <> ‘Text’ is ok and it hides the row that contains “text”, but if I add the rest of command it blocks. Even if I only write TimeStamp = NOW() or TimeStamp <> NOW() it still blocks. Do you know why? Thanks a lot!
I am trying something else. I want to write some php code to manually modify something in the database. I did a new function, I copied the function Edit from datasetdata.data.class.php and I modified it a little to do what I want to do. Here it is: