Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
21
Erster Beitrag:
vor 3 Jahren, 2 Monaten
Letzter Beitrag:
vor 3 Jahren, 2 Monaten
Beteiligte Autoren:
Yogi Yang, DarrenF, Paulo Oliveira, Allard, DerekT, iso

Data Refresh Problem!!!?!?!?!?!

Startbeitrag von Yogi Yang am 11.09.2014 07:05

I have been facing a problem in a software that I have developed.

This software is a Job Work Task management system.

In this I have a window in which there is a list of Job Work Tasks which are open. Here a user can edit a Task and set it's status to close.

Now in the window the Table (that shows open status tasks) is updated and it will not show any closed Job Work Tasks.

For use to be able to see Closed status tasks I have created another window which only lists Closed Job Work Tasks.

After setting the status of the Job Work Task to closed when a user opens the Closed Job Work Tasks Window, the task that was recently updated to closed status does not appear. In short the data does not seem to get refreshed.

Now if a user closes the app and then restarts it, then the closed task starts showing up.

What must be the problem here?

I have observed that if I set the Independent Hyper FileSQL context property the data seems to get refreshed properly.

Is this a know problem?

How to solve this permanently?

TIA

Yogi Yang

Antworten:

Hi Yogi,

You don't give much info on how you are managing the table, but are you issuing a TableDisplay() statement to refresh the Table control contents?

von DarrenF - am 11.09.2014 07:27
How is your table filled, linked to the file, query, by programming?

If it works with Independent Hyper FileSQL context and when you restart your app normally is some filter active for the same file in another window (like open job tasks) or something like that.

von Paulo Oliveira - am 11.09.2014 09:22
You can change your table content to "loaded in memory" to fix this.

von iso - am 11.09.2014 09:52
Sorry I missed mentioning that part.

I am connecting Table control to file or query in all cases.

von Yogi Yang - am 11.09.2014 12:36
In this case is file or query?

von Paulo Oliveira - am 11.09.2014 13:42
In this particular case the table is linked to a query which returns all Jobs that are Open.

In another window there is a query that will return all Closed Jobs.

von Yogi Yang - am 11.09.2014 13:50
when you change the task from open to close you use hmodify to the query, file or it's done by one sql update?

von Paulo Oliveira - am 11.09.2014 13:56
Here is the code that I am using.

IF COMBO_Agent = 0 THEN
Info("Please Select a Collection Agent")
ReturnToCapture(COMBO_Agent)
RETURN
END

IF COMBO_Party = 0 THEN
Info("Please Select a Party/Customer")
ReturnToCapture(COMBO_Party)
RETURN
END

IF COMBO_Size = 0 THEN
Info("Please Select a Job Size")
ReturnToCapture(COMBO_Size)
RETURN
END

IF COMBO_Machine = 0 THEN
Info("Please Select a Machine this Job will be Processed on")
ReturnToCapture(COMBO_Machine)
RETURN
END

IF EDT_Qty


von Yogi Yang - am 12.09.2014 03:58
Yogi,

You're issuing a Close() statement at the end of your code which leads me to believe that you're opening another window to make the changes to your data?

When you close/return to your main window are you issuing a TableDisplay statement to refresh your Table control?

von DarrenF - am 12.09.2014 07:53
Here is what I am using in the call window to refresh the data.

TableDisplay(TABLE_Jobwork)


But if I use the code

TableDisplay(TABLE_Jobwork, taReExecuteQuery)

If works fine but then the query paramentes are not take into consideration!

von Yogi Yang - am 12.09.2014 13:24
Yogi,

You're nearly there - take a look here:
http://doc.pcsoft.fr/en-US/?1013203&name=Query_and_browsing_table

von DarrenF - am 12.09.2014 13:50
Darren,

Thanks for the link but I will read all this material and see how I can solve this problem once and for all. :)

von Yogi Yang - am 12.09.2014 14:35
when you have data comming from one query it only refreshes when you execute the query again.

von Paulo Oliveira - am 12.09.2014 15:46
Yogi,

It's under the heading:

Quote
Browsing Table control based on a query with parameters (independent or embedded query)


I'm not at my PC so haven't tried it, but why not try setting the query parameters just before TableDisplay:

QRY_Jobwork.Param1 = xxxx
QRY_Jobwork.Param2 = xxxx
...
TableDisplay(TABLE_JobWork, taReExecuteQuery)


von DarrenF - am 12.09.2014 16:10
Hi yogi. There is a diffirence if you use a embeded or a normal querie. But for both there is an easy way to refresh

You have to untherstand how wx works with tables. There is a initiation part of the table in this part you can set all kind of thing that need to be done

If you set the code in the initiation right all you have to do to get the table refreshed with following

tabledisplay(tablename, tainit)

The taint part of tablediplay() function means that the initiaton code has to be run again.

So if you have a table on a querie with parameters ( normal querie ) you can enter following in the int code of the table

qry-queriename.parameter1 = xx
qry-queriename.parameter2 = xx
if some condition then
qry-queriename.parameter3 = xx
end

with an embeded querie you have to use

mysource.parameter = XX

In your case you can easily add a parameter to the querie and keep everything in one window, even one table

Add a parameter that doe following:
1 shows all thejob tasks ,
2 shows just the closed tasks
3 shows just the open tasks

if you put a combo on the screen with tthree options And in your querie you define a paramter on say state
state = 1 is all tasks
state = 2 is just closed taks
state = 3 is just open tasks

In the initcode of the table you put something line this:

Switch combo
case 1
qryparam.param = 1
case 2
qryparam.param = 2
case 3
qryparam.param = 3
end

Then all you have to do is select someting in the combo. In the onchange of the combo you place :
tabledisplay(tablename,tainit) and you are done

Hope this helps and gives you some insight

Regards

Allard

von Allard - am 12.09.2014 17:55
Darren,

Quote
DarrenF
I'm not at my PC so haven't tried it, but why not try setting the query parameters just before TableDisplay:

QRY_Jobwork.Param1 = xxxx
QRY_Jobwork.Param2 = xxxx
...
TableDisplay(TABLE_JobWork, taReExecuteQuery)

I read somewhere that calling TableDeisplay with taReExecuteQuery will execute the Query without parameters so setting parameters will not have any effect.

Are you sure this will work?

TIA

Yogi Yang

von Yogi Yang - am 13.09.2014 13:31
TableDisplay(MyQuery,taReExecuteQuery) does just that - re runs the query.
No parameters will be taken into account - same as running it from the query editor with the params unchecked.
Darren has put you on the right track.

von DerekT - am 13.09.2014 14:08
Hi Yogi,

Have a LOOK At my earlier post. You donnot need taRexecuteQuery. all you need is taInit.

Tainit will run your querie again and with parameters.

If you get how this works it is really easy to use. Verry powerfull with verry view code.


regards

Allard

von Allard - am 13.09.2014 18:03
This is the section I was referring to - see the very last section...

Browsing Table control based on a query with parameters (independent or embedded query)
.
blah...blah
.
Passing parameters to the query: Query Name.Name of Parameter1
xxx ==All the query parameters do not necessarily have to be specified. The query conditions that use unspecified parameters will be ignored. See Methods for passing parameters to a query for more details.
Note: If no query parameter has been specified before the query is run for the first time, the query will not run. The Table control associated with the query will remain empty.

Caution: All the query parameters are re-initialized whenever the query is run. The values that have been used beforehand are not stored. You must redefine the query parameters so that it can be run again.

Special cases: Initializing a Table control or using TableDisplay without the taReExecuteQuery constant
•If no query parameter was modified since the last query execution, the query will not be re-run. The Table control will display the records corresponding to the last execution of the query.
•After modifying the parameters of the query, the TableDisplay (or ListDisplay for a List Box or COmbo Box control) lets you re-run the query. The Table control displays all the records corresponding to the specified parameters.

Special case: Using TableDisplay with the taReExecuteQuery constant
To force the re-execution of the query, simply use TableDisplay (or ListDisplay for a List Box or Combo Box control) with the taReExecuteQuery constant.
Reminder: The structure of the query parameters being reinitialized whenever the query is run, don't forget to redefine the requested parameters before using this function.


von DarrenF - am 14.09.2014 10:20
Allard,

It seems that this

tabledisplay(tablename, tainit)

as per your instruction does the trick!

Thanks you for this.

Darren,

I have read the whole page online thanks for the link.

The web page states: Reminder: The structure of the query parameters being reinitialized whenever the query is run, don't forget to redefine the requested parameters before using this function.

But TableDisplay does not function as documented. When we use taReExecuteQuery is does not seem to take the parameters into consideration in my case.

TIA

Yogi Yang

von Yogi Yang - am 15.09.2014 14:13
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.