PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → View problem
View problem
Débuté par John Marrone, 06 juil. 2004 15:17 - 6 réponses
Posté le 06 juillet 2004 - 15:17
I can not get this code to work. It will crash when it tries to execute the HViewToFile function. The error message is in french so I have no clue. I have read the help. Here is the code. I am executing it in a menu click event. The table has over 500 records in it.
Rac is a Data Source
IF NOT HCreateView(Rac, DEMO_Testdata,"*","",hViewLocking) THEN
Info("Could not create view!!")
RETURN
END
IF NOT HExecuteView(Rac) THEN
Info("Could not execute view!!")
RETURN
END
HReadFirst(Rac)
WHILE True
Rac.DEMO_Version = 1
HModify(Rac)
Info(Rac.RaceID + " " + Rac.DEMO_Version)
BREAK
END
HViewToFile(Rac)
Thanks
John Marrone
Posté le 06 juillet 2004 - 15:36
>Here is the error message I am getting.
Error in Menu Selection of _Menu.Testing process, line 19.
HViewToFile function called.
Pour reporter les enregistrements de la vue dans la table d'origine, il faut avoir rempli la vue en mode blocage.

John


I can not get this code to work. It will crash when it tries to execute the HViewToFile function. The error message is in french so I have no clue. I have read the help. Here is the code. I am executing it in a menu click event. The table has over 500 records in it.

Rac is a Data Source
IF NOT HCreateView(Rac, DEMO_Testdata,"*","",hViewLocking) THEN
Info("Could not create view!!")
RETURN
END
IF NOT HExecuteView(Rac) THEN
Info("Could not execute view!!")
RETURN
END
HReadFirst(Rac)
WHILE True
Rac.DEMO_Version = 1
HModify(Rac)
Info(Rac.RaceID + " " + Rac.DEMO_Version)
BREAK
END
HViewToFile(Rac)

Thanks
John Marrone
Posté le 06 juillet 2004 - 15:42
G'day John
Two possibles !
#1
You don't need the HExecuteView() because the HcreateView() has already created a file in memory. You only need the execute for a postponed view, so that may be causing your problem.
#2
The full Hcreateview() syntax is HcreateView(viewname,filename,itemlist,sort,selectionCondition,mode).
Your code has the mode where the selectioncondition should be, so it is possible that the view is not locking the file. When Windev parses a view or fileter condition and fails it does not always generate an error.
In addition
Your view read loop would usually be While not hout() and you would normally hreadnext() to go to the next record in the view, although I appreciate that for test purposes you want to break out after reading a single record. Personally I have never liked using breaks in loops and would rather hreadlast() to get out.
Regards
Al
Posté le 06 juillet 2004 - 15:47
G'day John
>Pour reporter les enregistrements de la vue dans la table d'origine, il faut avoir rempli la vue en mode blocage.
It won't advance your cause much but this is a literal Systran translation.
"To defer the recordings of the sight in the table of origin, it is necessary to have filled the sight in blocking mode."
I presume Windev thinks the file is not locked (blocked ?)

Regards
Al :)
Posté le 06 juillet 2004 - 16:06
Hi Al
Your first possible did the trick. As far as the loop goes, to read 1 record I didn't even need a loop. The HOut() replaces what I know as rs.EOF. Thanks for the extra tips.
John Marrone
G'day John
Two possibles !
#1
You don't need the HExecuteView() because the HcreateView() has already created a file in memory. You only need the execute for a postponed view, so that may be causing your problem.
#2
The full Hcreateview() syntax is HcreateView(viewname,filename,itemlist,sort,selectionCondition,mode).
Your code has the mode where the selectioncondition should be, so it is possible that the view is not locking the file. When Windev parses a view or fileter condition and fails it does not always generate an error.
In addition
Your view read loop would usually be While not hout() and you would normally hreadnext() to go to the next record in the view, although I appreciate that for test purposes you want to break out after reading a single record. Personally I have never liked using breaks in loops and would rather hreadlast() to get out.
Regards
Al
Posté le 06 juillet 2004 - 16:16
Hi John
The error message is in french so I have no clue
What is the french message (I will translate it)
Olivier

"John Marrone" <marrone@brisnet.com> a écrit dans le message de
news:40ea8fdb$1@news.pcsoft.fr...


I can not get this code to work. It will crash when it tries to execute

the HViewToFile function. The error message is in french so I have no clue.
Posté le 06 juillet 2004 - 20:06
Hi John,
I think that you have to lock your view.
Olivier
"John Marrone" <marrone@brisnet.com> a écrit dans le message de
news:40ea9bb4$1@news.pcsoft.fr...

Here is the error message I am getting.
Error in Menu Selection of _Menu.Testing process, line 19.

HViewToFile function called.
Pour reporter les enregistrements de la vue dans la table d'origine, il

faut avoir rempli la vue en mode blocage.

John


I can not get this code to work. It will crash when it tries to execute

the HViewToFile function. The error message is in french so I have no clue.
I have read the help. Here is the code. I am executing it in a menu click
event. The table has over 500 records in it.

Rac is a Data Source
IF NOT HCreateView(Rac, DEMO_Testdata,"*","",hViewLocking) THEN
Info("Could not create view!!")
RETURN
END
IF NOT HExecuteView(Rac) THEN
Info("Could not execute view!!")
RETURN
END
HReadFirst(Rac)
WHILE True
Rac.DEMO_Version = 1
HModify(Rac)
Info(Rac.RaceID + " " + Rac.DEMO_Version)
BREAK
END
HViewToFile(Rac)

Thanks
John Marrone