Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
3
Erster Beitrag:
vor 3 Jahren, 2 Monaten
Letzter Beitrag:
vor 3 Jahren, 2 Monaten
Beteiligte Autoren:
Fabrice Harari, Danny Lauwers, Allard

Custom fields in windev

Startbeitrag von Allard am 15.04.2015 08:58

Hi

I am thinking of adding the feature that gives the user the ability to add custom tekstfields.

Iam still trying the figger out how to do this . I have come up with the following. so far Maybe some of you could give some feetback on it, add some thoughs etc.

Maybe someone knows exactly how this work, is best done ?

I want to add a table in this table I add a string type. Memo . This string holds the info of all the fields. that are added.

regards

Allard

Antworten:

Hi Allard,

You can have different ways of implementing this, it depends if your fields need to be searchable in a query or select. If there are a lot of custom fields needed or only a few.

In order of preference:

1) You could have 1 extra table that holds all custom fields with reference to what table and what record it is related to. With a join you could always return the custom fields with the select of your base table.
2) You could alter the table and add a column of the selected type to the table
3) You could use a memo with XML inside describing the fieldtype and data
4) You could make a few extra fields "CustomField1,CustomFieldType1, CustomFieldName1,..) in the existing table and use those if needed. This is only good if you only need a few fields.

If you use the analysis directly it would save you time if the fields where physically in a table.

Maybe other people use other methods, I usually use option 1, but it depends on the situation of your application.

Good luck
Danny

von Danny Lauwers - am 15.04.2015 11:51
Hello Allard

I do this kind of things using the Name/Value pair system. Basically, it's a text memo field formatted like an INI file (if you look at my wxreplication system, there are two classes there just to manage that).

This gives you all the flexibility you need to organize things any way you want. Personally, I use the prefix of the name part to determine the TYPE of variable and the matching field to use.

If FAST searches are needed on some of the fields (rare, as thee are EXTRA fields), then I use a ad hoc index file: the file contains the name of the File+Field, the search value, and the original record unique key... It's quite easy to use.

Best regards

von Fabrice Harari - am 15.04.2015 13:23
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.