Hide 1 field then click one button to reveal the field.

This forum is for application developers who are integrating HanDBase into their solutions via the HanDBase API (HAPI) or other means. It's also a great place to discuss runtime development.

Hide 1 field then click one button to reveal the field.

Postby jonmillar » Sun Oct 30, 2011 4:38 pm

Hi guys, just wondering can you have a form that has a table with 6 fields attached to it, 5 fields are questions and the 6th field is the answer ie A,B,C,D,E. What I would like to know is can handbase have one field on a form invisible with an accompanying button that you click which then reveals the field, ie the answer?

Many thanks
Jon
jonmillar
 
Posts: 7
Joined: Sun Oct 30, 2011 4:32 pm

Re: Hide 1 field then click one button to reveal the field.

Postby Brian_Houghton » Sun Oct 30, 2011 10:12 pm

Hi Jon,

HanDBase Forms does provide some conditional visibility options for its UI elements. It is possible that what you are describing can be done with a bit of work. Here's one possible way to implement it:

1. Add an integer field called "status". Set its default value to 0.
2. Add a series of calculated fields that evaluate the answer to your questions. If the answer meets your criteria (matches a defined value) have the condition set the value of the status field to 1.
3. Add a final element that you want to show when the answer is selected. Set it to be conditionally visible based on the value of the status field.

Hope this points you in the right direction.
Kind Regards,
Brian Houghton, DDH Software
Brian_Houghton
 
Posts: 2246
Joined: Wed May 20, 2009 8:30 am

Re: Hide 1 field then click one button to reveal the field.

Postby jonmillar » Mon Oct 31, 2011 8:00 am

Hi Brian

Thanks for the reply, I've been playing all morning trying to do what you suggest, I think I have come close but am not quite getting it, is it possible for you to expand on your idea? I've previously programmed in MS Access so I think that it is clouding my ways!

Thanks again
Jon
jonmillar
 
Posts: 7
Joined: Sun Oct 30, 2011 4:32 pm

Re: Hide 1 field then click one button to reveal the field.

Postby jonmillar » Tue Nov 01, 2011 3:33 am

Sorry Brian,

I should be more specific.

I have managed to make my answer field conditionally appear and dissappear based on the 1 or 0 value of the status field, however to activate this, I need to manually type a "1" or a "0" into the field on the form, what I would dearly like is to activate this process via a button on the form.

I also created 4 additional fields that have default values of "A", "B", "C, "D" then I created another field with a formula that stated that IF the Answer Field = Field "A" then change the status field to 1 (my theory being that the answer gets revealed). I was going to do this for all 4 options - have 4 Buttons, Button A Button B Button C and Button D. The formula would be false for 3 of the 4 buttons and either do nothing or present an "Incorrect" messagebox and the fourth one would reveal the Answer field. What I cant seem to do is link this field with the formula to run from the click of a button.

Is that making sense? IS there a way to activate the formula field via a button on the form?

Many thanks and sorry for the hassle
Jon
jonmillar
 
Posts: 7
Joined: Sun Oct 30, 2011 4:32 pm

Re: Hide 1 field then click one button to reveal the field.

Postby Brian_Houghton » Tue Nov 01, 2011 4:45 am

Hi Jon,

Thanks for following up. What I would try doing is adding conditional fields that evaluates the answers to your questions. If the answer is what you want it to be, it sets the value of the status field to 1, therefore forcing the display of the final field. Give it a try to see if that works for you.
Kind Regards,
Brian Houghton, DDH Software
Brian_Houghton
 
Posts: 2246
Joined: Wed May 20, 2009 8:30 am

Re: Hide 1 field then click one button to reveal the field.

Postby jonmillar » Wed Nov 02, 2011 3:24 am

Hi Brian,

Ive done it! Thanks alot! I created a button, linked it to the Status field, gave it the Caption "1" then when it is clicked I "appended value to field", the status field is invisible so I click on 1 and the answer field pops up, then I reversed the process on a "Next Record" and "previous Record" button so the answer is made invisible between records, works beautifully!!

Now then another question, now that Ive got the form working, I need to import records, Ive created a CSV file in Excel, successfully linked the deskop IP address and successfully transferred the file to Handbase in Ipad HOWEVER the problem is it is not copying the fields, it is just creating one big field.

Heres an example of 2 lines of my csv file : 1st row is the field names, 2nd row is the first record

"Question","A","B","C","D","Answer","Status (first line with field headings)
"What time is it?","9am","10am","12pm","2pm","A","0" (Ive added the "0" field to the end to populate the status field for all records with a zero intially as it get changed via the button on the form.)

So just a successful import of a CSV file to go then Im in business!

Thanks inadvance
Jon
jonmillar
 
Posts: 7
Joined: Sun Oct 30, 2011 4:32 pm

Re: Hide 1 field then click one button to reveal the field.

Postby jonmillar » Thu Nov 03, 2011 6:40 am

Ive now cracked the CSV import too!

ONE more question please, Im trying to copy a form that Ive created and paste it into another database with the same fields. Ive successfully used the desktop link to copy and upload to Handbase but when I go back to the ipad I cannot find the form. Where does it live once uploaded to the ipad and how do I copy it into a database?

Many thanks
really close now!

Jon
jonmillar
 
Posts: 7
Joined: Sun Oct 30, 2011 4:32 pm

Re: Hide 1 field then click one button to reveal the field.

Postby dhaupert » Thu Nov 03, 2011 7:08 am

Hi Jon,

I'm guessing that you copied the form to a new file name and then uploaded back? The forms file is like a database- the file name is actually irrelevant to the program since within the file itself is the name of the database that it matches to. So for example if you have a database named 'a' and a set of forms to go with it, internally the forms file will point to database 'a' and renaming the file won't do anything to change that. While you could technically use a binary editor and edit the first 32 characters of the file to change the name, this can be tricky as most editors are not binary but text based.

An alternative is if you have the desktop forms designer- it has a way to copy a form from one database to another. And you can copy each and every form from one database to the other that way.

Another trick I've used with success is this:

- Let's say you have database 'a' and 'b' and they are identical structure wise. Database 'a' has forms associated with it and you'd like to copy those to database 'b'.
- Back up database 'b' to your desktop.
- Delete database 'b' from the device.
- Use the + button to create a new database and choose 'use existing template'. Choose database 'a' and then give it the name database 'b'.
- Now use the desktop connect button and then upload database 'b' back to the device.

Assuming the structures were truly the same, they should be merged and you wind up with a database 'b' with the forms from 'a'.

Hope this helps!
dhaupert
 
Posts: 4111
Joined: Tue May 26, 2009 11:51 am

Re: Hide 1 field then click one button to reveal the field.

Postby jonmillar » Thu Nov 03, 2011 9:19 am

Hi Dave,

FANTASTIC, it worked a treat, really starting to get my head around your marvellous Handbase now, really liking it.

Promise this is the last question, I now have all my individual databases, I want to create a MAINMENU form, is there a way to force a database to open with the Form rather than the record list?

Loving this, thanks SOOOOOO much for your time it is really appreciated

Jon :D
jonmillar
 
Posts: 7
Joined: Sun Oct 30, 2011 4:32 pm

Re: Hide 1 field then click one button to reveal the field.

Postby dhaupert » Thu Nov 03, 2011 9:43 am

Hi Jon,

Really glad you're loving it! There is a section in the database properties called startup. In there you can specify that when a database is opened it launches to somewhere other than the List View. For example there is an option for adding a new record automatically. If you selected that option, and there was a form defined for the new record operation it would then show that form. If you don't want to create a new record each time, you can select to edit the last created record and as long as there was a record created it would open that (and the edit record form).

Hope that helps!
dhaupert
 
Posts: 4111
Joined: Tue May 26, 2009 11:51 am

Next

Return to HanDBase - Developers

Who is online

Users browsing this forum: Yahoo [Bot] and 0 guests