Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
6
Erster Beitrag:
vor 4 Jahren, 10 Monaten
Letzter Beitrag:
vor 4 Jahren, 10 Monaten
Beteiligte Autoren:
Yogi Yang, Alexandre Leclerc, ICI

Advise on how to use Query and Index

Startbeitrag von Yogi Yang am 12.06.2013 06:37

In the software that I am converting we have used around 300 queries in the software.

I want advise as to how program in WD. Should I create all the queries before hand or would it be advisable to build SQL queries on fly in code and then execute them as we are doing in original software?

Another thing. How to get HF to activate a particular index associated with a data file so that the contents of the data file will automatically get sorted as per the index associated?

TIA

Yogi Yang

Antworten:

Hi Yogi,

Using the queries (as object) is better because it will keep in sync with any changes in the analysis. You can recreate them quickly in using the SQL mode (F2) instead of the wizard. It also has the advantage of reusing or at least not duplicating the same query here and there.

But if you do not use the analysis, writing them directly would save you time.

As for using a specific index, as far as I know, this is not possible. HyperFile select itself the better method to execute a query, using stats, etc. In version 18 you have the new EXPLAIN sql command that you put in front of a query to see how it is executed by the server. (There is an example in LST92.)

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 12.06.2013 14:43
Hi,

I think have sorted out as to how to activate an Index in HF!

We can use the index that we have defined in HF while navigating in the file.

Like for example if I need to get the last record in Datafile based on and index that I have defined in Analysis, what I can do is:

HLast(DataFileName, IndexName)


If my conclusion is wrong then please do correct me.

Regards,

Yogi Yang

von Yogi Yang - am 18.06.2013 06:11
Hi Yogi,
Don't take me wrong but, I read your posts last few days and all are based on very simple questions which mean that you maybe need first to read tutorial, help files for all questions you try to ask here. If you stuck you can ask and we all will be happy to help you.
Don't skip Tutorial and help. It is foundation for your life. If you skip it you will always be outside of the road.

Again, Don't take me wrong, but
HreadLast() or HReadSeekLast() are questions for help where is this very clear descripted.
Also, HIndex() and similar standard commands which you probably already use in you past programming language. .FIC, .NDX, .MMO and so on (DBF,NTX,MDX,FPT,DBT,...)

You need to understand base of windev like in all other programming tools/languages.

Best regards !

von ICI - am 18.06.2013 06:31
Hi Yogi,

Yes, you can browse / loop through files using indexes. Here are some examples:
- http://doc.pcsoft.fr/en-US/?1510013
- http://doc.pcsoft.fr/en-US/?3044125

I my answer I understood that you wanted to use a given index inside a query.

As ICI kindly suggested, I would also take time to look at the help a little bit. There are tutorials. Online, you can see the general concepts (bottom right "To start with"): http://doc.pcsoft.fr/en-US/

In your WinDev program folder, there is a folder that should have a name like "Self training" and inside you have the full PDF of the training manual. Accessible from the IDE besside the help button.

It will take you few hours but will make you much more comfortable and productive quickly.

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 18.06.2013 12:23
@Alexander,

Thanks for the links.

@ICI,

I am trying very hard to understand and set my mind to work with WD's programming paradigm but at times I am faced with problems when converting existing software to WD so I am posting.

Regards,

Yogi Yang

von Yogi Yang - am 19.06.2013 13:33
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.