Alpha Video Training
Results 1 to 18 of 18

Thread: Using same table for textbox results and browses

  1. #1
    Member
    Real Name
    Aaron Okievs
    Join Date
    Feb 2011
    Posts
    18

    Default Using same table for textbox results and browses

    Is it me... or is not it actually possible to use the same table for both textboxes/comboboxes and a browse on the same form, in that, when data is entered on the textboxes/comboboxes, the data will not immediately display its result on the browse not until the onClick event is fired to save or to delete the result from the browse?

    I've been trying to make this work with no end. It looks simple, but just couldn't make it work :) Please can anyone tell me how this is accomplished, or if I'll have to make use of a set (how to make the relationship)...to make this possible.

    I will really appreciate it.

    Thanks a lot.

    Aaron.

  2. #2
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,366

    Default Re: Using same table for textbox results and browses

    What?
    Question 1. It is possible to have a browse and fields on a Form at the same time. If you change data in either the form object or the browse object, you will get the corresponding change when you Save. You can save automatically when leaving the field so the two are in synch.

    Question 2. You don't need a set if you are only working with one table.

    Please post an example of where you have gotten to.
    Control Panel (CP
    ..Tools
    ...Zip
    Forum
    ..Go Advanced
    ....Manage Attachments
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  3. #3
    Member
    Real Name
    Aaron Okievs
    Join Date
    Feb 2011
    Posts
    18

    Default Re: Using same table for textbox results and browses

    Hello Ted,

    Thank you very much for your reply. I am working with One table (Specialty) as primary table, and (Department) as linked table to the Specialty table.

    I've attached a photo giving brief description of each form object, and a .ZIP file of the database:
    HMSDB.zipspecialty_sample.jpg .

    Description of form objects and browse as labeled on the photo, with expected desired results:
    -------------------------------------------------------------------------------------------
    1. Add records to the Department table: The Add button [+] will popup a dialog box form for Department table, and after the data is entered, the Save button on the Department table dialog box will insert the data on the Department table. This saved data will then be available on the Department Drop-down ComboBox of the SpecialtyForm.

    2. Deletes selected record from the Department table through the "Department Textbox": When a record is selected from the Department Textbox, it can be deleted from the Department table by clicking the Delete button [X] close to the Department Textbox object

    3. Performs the onClick events to INSERT (Save) inputted data from the form objects to Browse object, UPDATE (Edit) and DELETE selected record(s) from the Browse object: When data is entered on the form objects (Department, Specialty), the Save button above the browse will Save the form object's data on the browse object (Department, Specialty).

    Also, the browse should not have the ability to add or edit data directly on it, but through the form objects above ( Department comboBox and Specialty TextBox ). When a row is selected on the browse, the DELETE button can directly delete the row from the browse object. This should be the only means of deleting data from the browse record.

    4. The saved record will not display on the Browse object until the "Save" button is clicked and the page refreshed: When the data is saved by clicking the Save button (3 above), the page will refresh, and the datas from the Department Combobox and Specialty TextBox will now display on the Browse object below the Form objects. The entered data on the form objects will not display on the browse object until the SAVE button is pressed.

    I hope this information clarifies my issues on the previous post.

    Thanks a lot

    Aaron.
    Last edited by aaronhaul; 01-14-2012 at 06:00 AM. Reason: Files has been attached

  4. #4
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,699

    Default Re: Using same table for textbox results and browses

    Hi Aaron,
    Why is the OnInit event of the form clearing the fields in the first record of the speciality table when the form opens? It seems you are also doing this in the department form when it opens so a new record is not added but is also blanking out the first record.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  5. #5
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,200

    Default Re: Using same table for textbox results and browses

    Aaron,
    I love your deliberate use of database language to convey your message. However, it seems that the concepts that you are portraying are a bit confused.
    3. Performs the onClick events to INSERT (Save) inputted data from the form objects to Browse object, UPDATE (Edit) and DELETE selected record(s) from the Browse object:
    I am not familiar with an OnClick event. Are you referring to a button OnPush event? The fields on the form and the Browse are both form objects. They are windows to the table that is behind them. You can insert values from one form object to another, but you cannot "save" values to form objects. The concept of save only relates to a table. You cannot save to a layout or layout object. You can only save values to a table. Once you save a value to a table, it can be displayed in a form object.
    when data is entered on the textboxes/comboboxes, the data will not immediately display its result on the browse not until the onClick event is fired to save or to delete the result from the browse?
    True, because the browse object is a window to the table behind it. The values in the form field objects are not part of the table that the browse is "showing" until the values are saved to the table. Then the Browse can "show" the values.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  6. #6
    Member
    Real Name
    Aaron Okievs
    Join Date
    Feb 2011
    Posts
    18

    Default Re: Using same table for textbox results and browses

    Hi Robin,

    My intention is to make the form fields blank, ready for data, when the OnInit event is triggered. I don't know if there's a way to make this possible without clearing the first record of the specialty and department table, but just the form fields.

  7. #7
    Member
    Real Name
    Aaron Okievs
    Join Date
    Feb 2011
    Posts
    18

    Default Re: Using same table for textbox results and browses

    Quote Originally Posted by MoGrace View Post
    Hi Aaron,
    Why is the OnInit event of the form clearing the fields in the first record of the speciality table when the form opens? It seems you are also doing this in the department form when it opens so a new record is not added but is also blanking out the first record.
    My intention is to make the form fields blank, ready for data, when the OnInit event is triggered. I don't know if there's a way to make this possible without clearing the first record of the specialty and department table, but just the form fields.

  8. #8
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,310

    Default Re: Using same table for textbox results and browses

    My intention is to make the form fields blank, ready for data, when the OnInit event is triggered.
    Aaron, your table field objects are bound to the underlying table. When you clear fields you're deleting field values from the the current record. Not a recommended way to begin a new record. I suggest you spend some time working through the user's guide and playing with the default form for your table. You're using techniques that are necessary with other development packages but are NOT necessary here.

  9. #9
    Member
    Real Name
    Aaron Okievs
    Join Date
    Feb 2011
    Posts
    18

    Default Re: Using same table for textbox results and browses

    Thank you for your reply, Mike,
    I am not familiar with an OnClick event. Are you referring to a button OnPush event?
    Yes Mike, I was referring to a button OnPush event, and not OnClick event.

    The fields on the form and the Browse are both form objects. They are windows to the table that is behind them. You can insert values from one form object to another, but you cannot "save" values to form objects. The concept of save only relates to a table. You cannot save to a layout or layout object. You can only save values to a table. Once you save a value to a table, it can be displayed in a form object.
    Since I cannot save values from one form object to another, can I insert values to the browse object from the Department and Specialty form objects? If that's actually possible, how can I do this by making the result not display on the browse not until the OnPush event is fired? With all this information, can you please make necessary adjustments to the database I attached so I can continue with your solution?

    Thanks a lot for your effort.

    Aaron

  10. #10
    Member
    Real Name
    Aaron Okievs
    Join Date
    Feb 2011
    Posts
    18

    Default Re: Using same table for textbox results and browses

    Quote Originally Posted by Tom Cone Jr View Post
    I suggest you spend some time working through the user's guide and playing with the default form for your table.
    Hi Tom,

    Where can I find the user's guide for such development? I would really like to make a design with my present requirements. If such techniques is meant for other development packages, how can I make that possible? What other development packages?

    Aaron.

  11. #11
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,310

    Default Re: Using same table for textbox results and browses


  12. #12
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,366

    Default Re: Using same table for textbox results and browses

    Aaron, I think you will need to create a Set using the Department and Speciality Tables for this to work properly. In the description you sent me, you mention a Link, but there is no set defined in the Database.
    The [Dept_ID] could be the linking field and the order could be [Spec Id], however the two tables do not seem to have a logical link between them.
    Is there a connection between Department and Speciality? I couldn't find an easily understandable relationship.
    You can restrict the actions in the Browse, and even restrict its display if you want to.
    As Tom suggests, read up on the User Guide and especially Sets and Browse controls.
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  13. #13
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,699

    Default Re: Using same table for textbox results and browses

    Hi Aaron,
    I see that you defined a lookup field rule from the Department table for the Speciality table Dept_Id field. In that field rule there are options to edit and add records to the Department table. This will provide the same functionality you are trying to do with the form's combo box and the add and delete buttons. To enter a new record into the speciality table you can use the toolbar button above the form, lookup the Dept_ID and add the specialty and when the record it saved it will appear in the browse below. An OnChange event can be added to those fields above the table to automate the saving of the new record, then you can omit the other buttons. So rather than blank out existing records to add new values to the table, you add a new record.

    I added a form using only the field rule lookup and messed a bit with the buttons on both forms. On your original form I kept the combo box but attached it to a variable defined as shared and added restrictions for Enter and Edit of records so the user must use the buttons on the form. That variable can then be used in a script to delete the current department from the department table - if that is what you still want to do. To make record changes, use the Edit button first.
    Attached Files Attached Files
    Last edited by MoGrace; 01-15-2012 at 01:20 PM.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  14. #14
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,200

    Default Re: Using same table for textbox results and browses

    Robin,
    You're example throws an error in my hands when opening your department form.

    Aaron,
    What you are wishing is possible, but not best achieved with how you are set up to try and achieve this. Having the Department Add form based on the Department table sure seems like it should be logical, but because of Alpha oddity, when starting with an empty table, you will always generate a blank record for the first table record. I have added a dummy table with one field. I used this table to generate a form for adding Departments. The form field is based on a form session variable. The value of that variable, when saved, is written directly to the Department table in the save button script of that form. This makes it available in the dept_id lookup. This avoids the first blank record being blank and any conflicts having to do with needing the form field to be blank when the add department form is opened, and the possibility of deleting existing records.

    Secondly, your delete button for the specialty browse was only addressing the browse. The other fields also belong to the specialty record. I moved that from only addressing the browse to addressing the entire parent record. The edit button doesn't really offer anything in this setting. A cursor in a field would engage an Edit/Change.

    That's about it, I think. Hope this helps
    Attached Files Attached Files
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  15. #15
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,699

    Default Re: Using same table for textbox results and browses

    Hi Mike,
    I don't know which form you were in since there are two. But the specialty form is the one where you must press the edit button first to make any changes. I think I allowed the combo box to always be modeless and that makes no sense if Edit is locked.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  16. #16
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,200

    Default Re: Using same table for textbox results and browses

    Robin,
    I was in the wrong form. Yours works well except at the very beginning with both tables empty. Adding a new department to a completely empty table doesn't become available in the variable field drop down. Don't know why, but it doesn't.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  17. #17
    Member
    Real Name
    Aaron Okievs
    Join Date
    Feb 2011
    Posts
    18

    Default Re: Using same table for textbox results and browses

    Thank you guys for all your contributions. It was really appreciated. Your help actually gave me more ideas to keep up with my project.

    I do still need your assistance, though, regarding the input fields: Dept_ID comboBox and Specialty_name textBox. I edited the Field Rules for both fields on the Specialty table making the fields "Required", so that when data is entered on the dept_id comboBox without inputting data on the specialty_name texBox, it will prompt the user that the specialty_name field is left blank, and vise visa.

    It actually works fine though, but the popup message Alpha 5 generates gives a default value for the message (Field is required: DEPT_ID for Department textBox, and Field is required: SPECIALTY_NAME) and its not so user friendly with an error popup on a form field.

    Is there a way I can indicate blank field without using a dialgoBox, like making the textBox and comboBox field background becomes RED or so, indicating that the field is left blank, and it can't be submitted, saved or left empty without inputting data first? I tried using ISBLANK("FIELD_NAME") on the Color Equations Genie on Field Properties, but I'm not having any responses. I don't know if I actually set it properly.

    Any ideas?

    Aaron


    UPDATED:
    I just used the codes:
    Code:
    case(isblank("DEPT_ID")=.F.,"black on white",.T.,"black on Red")
    Code:
    case(isblank("SPECIALTY_NAME")=.F.,"black on white",.T.,"black on Red")
    to give the field color red if left blank. It still saves the data on the form though the DEPT_ID is left blank. Is there a way to give the blank field focus when it's left blank, until its data is inputted?
    Last edited by aaronhaul; 01-16-2012 at 09:29 PM. Reason: added request

  18. #18
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,200

    Default Re: Using same table for textbox results and browses

    Aaron,
    You will read on this board that most experienced developers will not use the required field rule because it in neither developer friendly nor user freindly. What is often used is the form CanSave event to check for the presence of a value in a form field, and cancel the save event, fire a ui_msg_box message and then place focus back on the field of concern (topparent:fieldofconcern.activate()) when the required field is empty. This tends to work pretty well.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

Similar Threads

  1. I'm about to give up. I've been trying to filter browse results with textbox inputs
    By iambenj in forum Alpha Five Version 10 - Desktop Applications
    Replies: 7
    Last Post: 12-15-2010, 05:03 AM
  2. Lookup table results-Bug ?-(with video)
    By itsski in forum Alpha Five Version 10 - Desktop Applications
    Replies: 16
    Last Post: 11-05-2010, 10:37 AM
  3. table.external_record_content_get() UNIQUE RESULTS
    By EricN in forum Alpha Five Version 9 - Desktop Applications
    Replies: 9
    Last Post: 08-08-2010, 12:34 AM
  4. after searchin a table, the results are hidden when sorting ?
    By Lost in forum Web Application Server v7
    Replies: 4
    Last Post: 03-09-2006, 05:49 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •