PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Dash board widgets Refresh
Dash board widgets Refresh
Iniciado por guest, 13,ene. 2016 08:47 - 9 respuestas
Publicado el 13,enero 2016 - 08:47
I am using dash board with a number of widgets on it..They displays results through executing querry on the initialisation of internal windows..Now I need to reflect the changes as time passes..ie number of items and values in db changes,so the widgets also need to be refreshed ..how it can be made dynamic ?? Help plz
Publicado el 13,enero 2016 - 16:35
Every time you change values in your Db run a procedure to update the widgets (Rerun internal window init code).

You can write code that runs every time you save changes or use HDescribeTrigger(). Note that HDescribeTrigger does not work with SQL queries. It only works with changes made via the H functions.

http://doc.windev.com/en-US/…
Publicado el 14,enero 2016 - 00:19
Amal,

Something like this:

//Filter The Job Table IF CT_IsWidgetsExist("IW_SH_JobList") THEN IW_SH_JobFilter.CT_FilterJobs() //Show the Job List Table IW_SH_JobFilter.TABLE_JF_JI..Visible = True END
To see if the window is visible
CT_IsWidgetsExist(sWIn is string) //See how many are in the dashboard control nCnt is int = DashCount(DASH_SalesHome,toTotal) //loop thru all the dash widgets find out who is here FOR i = 1 TO nCnt IF DASH_SalesHome..Name = sWIn THEN RESULT = True BREAK ELSE RESULT = False END END
DW
Publicado el 14,enero 2016 - 12:33
Hi curtis
As u said ,calling a procedure to refresh widgets every time db changes is a solution..But it is not so easy as db changes so frequently by differnt users throgh different forms....and so many widgets are used in dashboard

I need another solution to refresh the internal window

Hi DW,
cant understand what u mean ..
Publicado el 14,enero 2016 - 14:15
Hi Amal,

If you build your internal windows properly (your refresh code has been put in the Widget refresh event of the internal window), you can simply call DashDisplay() to do that job. http://doc.windev.com/en-US/…

Best regards,
Alexandre Leclerc
Publicado el 18,enero 2016 - 09:44
Hi Amal,,

You can even refres only one IW if you profide the Internal windeow as a parameter:

Dashdisplay(dashboard,IW-name)

Or if you fill everythingby programming as I do and use 1 internal window many times for the dynamic generation of widgets you can use the index as a parameter to refres a certain IW

regards
Allard
Publicado el 19,enero 2016 - 16:03
What about using Timers ?
Publicado el 20,enero 2016 - 05:35
Hi all,
Thanks for all of ur suggestions..

Luiz,, Is there any possiblity to use timers which refresh the initialisation code of the internal windows at certain intervels?

When i used timers before in another form ,the application gets slow down and hanged for a while.
Publicado el 21,enero 2016 - 22:00
Bit late to the party but this is the method I employ...

In the window Global Declaration
STR_ActiveWidgets is Structure WidgetName is string END Arr_ActiveWidgets is an array of STR_ActiveWidgets wbConfigSave is boolean In the End of Initialization
//Load active Widgets lpLoadActiveWidgets()
PROCEDURE lpLoadActiveWidgets() //Declare local structure LSTR_ActiveWidgets is STR_ActiveWidgets lnSeekRes is int //See how many are in the dashboard control lnWCount is int = DashCount(dbdDashboard,toTotal) //Loop to get the active widgets FOR i = 1 TO lnWCount //This Procedure is called whenever a Widget is added or removed //so need to check if they are already in the process list lnSeekRes = ArraySeek(Arr_ActiveWidgets,asLinear,"WidgetName",dbdDashboard..Name) IF lnSeekRes <= 0 THEN //Not found so add LSTR_ActiveWidgets.WidgetName = dbdDashboard..Name ArrayAddLine(Arr_ActiveWidgets,LSTR_ActiveWidgets) END END //Fire up the 'timer' procedures a_WMonitor_A() a_WMonitor_B() a_WMonitor_C() A call is made to this procedure every time a Widget is added or removed.

I also store users different configurations in a datafile so that they can display widgets depending on tasks they have to do - a call is made every time a new config is loaded.
Also means that these are not left if they change machines.

I have as many 'Timer' procedures as necessary.
Typically dependent on how much work (time) each widget requires to return the information required.
Each is identical although the repeat time is varied to suit the workload

// Automatic Procedure: // The procedure is run manually, during a call in the code // The execution will be done at the end of the process containing the call // It will be repeated in loop, with a timeout set to 20 seconds between each call // A new timer is created whenever the procedure is called // PROCEDURE a_WMonitor_A lnSeekRes is int //Check to see if the window is active lnSeekRes = ArraySeek(Arr_ActiveWidgets,asLinear,"WidgetName","IW_Window_a") IF lnSeekRes > 0 THEN //If found run the required procedure on the internal window IW_Window_a.lpMyProc //Refresh the widget display DashDisplay(dbdDashboard,IW_Window_a) END lnseekres = arrayseek(Arr_ActiveWidgets,asLinear,"WidgetName","IW_Window_b") if lnSeekRes > 0 then //If found run the required procedure on the internal window IW_Window_b.lpMyProc //Refresh the widget display DashDisplay(dbdDashboard,IW_Window_b) END lnseekres = arrayseek(Arr_ActiveWidgets,asLinear,"WidgetName","IW_Window_c") if lnSeekRes > 0 then //If found run the required procedure on the internal window IW_Window_c.lpMyProc //Refresh the widget display DashDisplay(dbdDashboard,IW_Window_c) END
When parallel tasks came out I thought that this could speed things up.
Unfortunately I have not been able to get them to work.
Code like t1 is ParallelTask = ParallelTaskExecute(IW_Window_a.lpMyProc) does not throw an error but equally does not run the procedure either.

My final variation is to have a basic 'Timed Procedure' that accepts a parameter containing the name of the internal window I need to trigger.
This I can call from anywhere in the app to update the dashboard when chosen action have occured
// Automatic Procedure: // The procedure is run manually, during a call in the code // It will be run in a thread (without having to call ThreadExecute), without using HFSQL // PROCEDURE Inst(psWidgetName is string) lnSeekRes is int lnseekres = arrayseek(Arr_ActiveWidgets,asLinear,"WidgetName","psWidgetName") if lnSeekRes > 0 then //If found run the required procedure on the internal window {"psWidgetName.lpMyProc",indItem} //Refresh the widget display DashDisplay(dbdDashboard,psWidgetName) END
It does actually all work quite well - current app has 37 IW's being updated by 6 'Timed Procedures' without any noticable effect on performance.

Your mileage may vary of course depending on how much data you are harvesting and the way in which your widgets display the result.

I have found that by allowing the users to have multiple configurations they tend to have far fewer on display at any one time which reduces the overheads considerably.
Publicado el 22,enero 2016 - 01:42
Hi

I have several dashboards in one app/Using the dashboard control onley ones. I would like to refress the dashboard.But since the control can be used to create multiple dashboards the dashdisplay() doesnot work. Nor does it work for the internal windows. As I have created a view template internal windows that can be used to create custom charts.

My solution for the time beingis to refresh the whole screen any one any I dea's ?

regards

Allard