PDA

View Full Version : User-defined Fields?


ABC123

WesOlfert
02-27-2005, 10:49 AM
Is there a way to setup user-defined fields in a table which the user (in Runtime Version) can rename to meet a specific need?

Different users of the same app may have some slightly different data needs, and I would like to be able to add the functionality to meet those needs, if possible.

One problem I foresee is not knowing the size of the field to create for this (not knowing the data that will be used in it) .

Anyway, I will appreciate any thoghts and suggestions.

Tom Cone Jr
02-27-2005, 12:26 PM
Wes,

changing fieldnames, field types, or field widths in the table structure requires the development version. No can do with the runtime. To me this is a very good thing. Any of these changes would break significant pieces of most finished applications.

In rare instances I've supplied "extra" fields, with generic names. The use could use them as they saw fit, but even then they couldn't change the underlying table structure.

-- tom

davej
02-27-2005, 12:32 PM
Wes,

One of the users could have a full version of V5 and therefore be able to add fields and/or change names, but as Tom says, you are asking for a world of trouble, especially if they call you when something doesn't work the way it used to work - and you can bet they will. You would be much better off just telling them that you are the only one that can make design changes if they expect you to support the application.

Dave

WesOlfert
02-27-2005, 01:13 PM
Thanks to both of you -- I suspected as much -- and it is certainly good to limit that kind of "messing" with the database. I, too, have include fields such as "Other1" "Other2" which can be used as you suggested. What prompted me to ask about this was that I am familiar with another database program (in Access) that does allow user-defined fields -- but I am not sure what the changeable parameters are.

Jay Talbott
02-27-2005, 03:32 PM
You could create two or three extra fields of character, date and numeric values in the appropriate table. With some sophisticated coding, you could ask the user to name the fields, and then change the labels on the forms and reports to the user's names without messing with the underlying structure.

Hope this helps.

Regards,

Jay Talbott

WesOlfert
02-27-2005, 03:39 PM
Sound like that would be helpful -- but at this point "sophisticated coding" is beyond my neopyhte abilities. If you can supply a sample without putting out too much effort, I'd love to study it and learn from it. Thanks for the idea.

Jim Chapman
02-28-2005, 10:11 PM
Hello Wes,

You can add fields to a table using the runtime. But you have to supply a little xbasic code. The following command:

A5_ADD_FIELDS_TO_TABLE("customer","TestField,c,30")

will add a field, (TestField, character, 30 length), to a table named customer.

There are many ways to setup your database to be able to do this. One way is to have a Utilities menu form with a button to "Run Updates". You can send a text file, containing your xbasic code, to the user. Pushing this button could run your code one time. I think I wrote up this approach in the newsletter a while back, along with several other approaches. It is really pretty easy to do. You can do your scripts with Action Scripting if you wish.

Good luck,
Jim

davej
03-01-2005, 06:10 AM
Jim,

As always, you have elegant solutions that others haven't thought of. But, if I may, I'd like to ask a question.

Assuming the end users add fields to the table using your method, how are those fields then incorporated into forms, reports, browses, etc., etc. in the runtime environment given the basic purpose of a runtime in the first place?

Dave

WesOlfert
03-01-2005, 06:46 AM
Thanks for the idea -- I do have same question that Jim just rasied, but I'll play with this idea and see wht happens.

WesOlfert
03-01-2005, 06:47 AM
Sorry -- I meant Dave, not Jim!!!!

Jim Chapman
03-01-2005, 06:55 AM
Hello Dave,

""how are those fields then incorporated into forms, reports, browses, etc., etc. in the runtime environment given the basic purpose of a runtime in the first place? ""

Well...... glad you asked :-) In this months newsletter I'm presenting routines that allow a developer to send to a remote site a single layout, ie: form, report, letter, or label that will then be incorporated into the remote database. This can either be an entirely new object, or replace an existing object as the developer chooses. This is sent as a single very small binary file.

But, besides the routines I referenced, we would do this the way we always have, by sending over the data dictionaries for the given tables/sets involved. The only difference is that the new routines allow us to do this one form, report, label, or letter at a time without overwriting the other forms/reports/labels/letters associated with a given table/set at the remote site.

Jim

davej
03-01-2005, 09:53 AM
Wes,

That's okay. Based on the amount of hair we both have, we are quite similar and are easily mistaken for each other. Beyond that, Jim is much more knowledgeable looking.

Dave

davej
03-01-2005, 09:59 AM
Jim,I think I didn't ask my question clearly enough. - A developer creates and deploys an application running under the runtime. The end user, using your suggestion creates additional fields, but the developer doesn't know that. How does the end user incorporate those fields into other objects (forms, reports, browses, etc.) without bringing the developer into the equation?Dave

Jim Chapman
03-01-2005, 11:25 AM
Hello Dave,

"" How does the end user incorporate those fields into other objects (forms, reports, browses, etc.) without bringing the developer into the equation?""

They can't, and we wouldn't want them to if they are running the runtime and a developer is maintaining/upgrading their application. The developer is necessary in creating the functionality to add the fields, and would have to be in the loop in adding/updating forms/reports, etc.

Jim