Use BrowseDialog to fill some fields


Author
Message
Guillermo Vilas
Guillermo Vilas
StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)
Group: StrataFrame Users
Posts: 112, Visits: 2.3K
You can notice the experience from a far distance BigGrin,

Dustin approach is quite simple and effective at the same time.

------------------------------------------------------------------------
I would like to change the world, but they don´t give me the source code.
MS Windows 7 Ultimate 64-Bit
Intel(R) Core(TM)2 Quad CPU Q9300 2.50 GHz
6.00 GB of RAM, NVIDIA GeForce 9800 GT

MacBook Pro i5 OSX Lion
Dustin Taylor
Dustin Taylor
StrataFrame Team Member (652 reputation)
Group: StrataFrame Users
Posts: 364, Visits: 771
Sure Smile

Here is a slightly simplified version of what we do:

Public Shared Function GetZipCode(ByVal ZipCode As String) As ZipCodeItem
   '-- Establish Locals
   Dim loReturn As ZipCodeItem
   '-- Create a new item
   loReturn = New ZipCodeItem()
   '-- Load the BO
   ZipCodesBO.FillByZipCode(ZipCode)
   '-- See if a record was found
   If ZipCodesBO.Count > 0 Then
      loReturn.AreaCode = ZipCodesBO.AreaCode.Trim()
      loReturn.City = ZipCodesBO.City.Trim()
      loReturn.State = ZipCodesBO.State.Trim()
      loReturn.ZipCode = ZipCode.Trim()
   End If
   '-- Return the results
   Return loReturn
End Function

 

We call the above method on the shared class whenever we want to get the details for a given zip code. A "ZipCodeItem" is returned, containing the details found there (AreaCode, City, State, ZipCode). As you can see, within the method we pull the zip code information into a temporary instance of our own ZipCode BO, but you could do the same with a straight SQL query if you would prefer and cut out that temporary BO all together.


Juan Carlos Pazos
Juan Carlos Pazos
StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)
Group: Forum Members
Posts: 144, Visits: 227
Hi Guillermo, Edjy and Dustin

Thanks for your ideas. Dustin yours is the more close to what I want to do. The web service is fine, but the postal codes are from Mexico and the information is not complete, I have all the complete database of postal codes with all details of information.

Can you put some code for have an starting point?

Thanks in advance.

Smile Everything is possible, just keep trying...

Dustin Taylor
Dustin Taylor
StrataFrame Team Member (652 reputation)
Group: StrataFrame Users
Posts: 364, Visits: 771
Juan,

The above ideas are good and would certainly work, but I'd actually recommend using a shared class rather than trying to plug additional logic into the browse dialog. 

In our medical app, we have a shared, non-inheratible class that can be referenced from any maintenance form.  Whenever a zip code is entered on a maintenance form, we call a method on that shared zip code class that will return the associated area code, city, and state so that those values may be used to populate the appropriate fields.  Our class does a few more fancy things than just that, but returing the derived information is it's core purpose, and it works very well.

Browsing on the zip code is somewhat unecessary since that is one thing people will typically know without having to search for it.  Once it is entered, you can then use that value to populate the remaining fields automatically without ever needing to use a browsedialog.

Hope it helps,

Dustin

Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Juan Carlos, Guillermo,

As far as I know the Dialog Browser will always display the records found in the search so the user can select the one they want to show in the form.  With this in mind, Juan Carlos, unless you want your end user to be always presented with the Dialog Browser to choose the data, then that may work.

On the other hand, your requirement is pretty simple, you just need a function, probably a Shared one which will return the City/State values when passed the zipcode value.  There are many variations of this one, also there are a couple of free Web Services which will accept the zip code value as a parameter and return you an XML file with the City/State values.

I believe that using the Dialog Browser for this would be overkill for the application and mostly the end user.

Edhy Rijo

Guillermo Vilas
Guillermo Vilas
StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)
Group: StrataFrame Users
Posts: 112, Visits: 2.3K
Hello Juan Carlos

It is possible, although I'm not sure the best approach.



The way I'm implementing this is:

1. Create a table that will contain zip codes, state, county information.

2. Create a BO to map that table: ZipCodesBO

3. Add the BO to the Customer Form (CustomerBO and ZipCodeBO)

4. Drop a BrowseDialog to the form and setup to fill de ZipCodeBO with the results

5. You may want to add a custom button to handle the ZipCodeBrowseDialog call or add the call method in a text validated event so after the user types a zip code the ZipCodeBrowseDialog will show but I'm not sure if you can pass the text entered as initial SearchField.

6. The if you have a TextBox to populate with the results it will need to map to the ZipCodeBO not the CustomerBO.



Hope it helps


------------------------------------------------------------------------
I would like to change the world, but they don´t give me the source code.
MS Windows 7 Ultimate 64-Bit
Intel(R) Core(TM)2 Quad CPU Q9300 2.50 GHz
6.00 GB of RAM, NVIDIA GeForce 9800 GT

MacBook Pro i5 OSX Lion
Juan Carlos Pazos
Juan Carlos Pazos
StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)
Group: Forum Members
Posts: 144, Visits: 227
Hi

I'm using BrowseDialog in may forms in my application, of course the BrowseDialog is always used to find an specific record.

I have the idea of use BrowseDialog just to fill some fields in my form, not to recover a record.

I will try to describe the idea:

I have a form to contacts, is a normal maintenance form, it has a BrowseDialog for find contacts. Part of the information of contacts is State - City - Locality - Postal Code. Some we have a field for each value, I use combos to select the state, based on selected other combo is filled with the city in locality I can use another combo too. But as the Postal Codes table has the information of locality, city and state, I think users can select a postal code and the fields of locality, city and state can be filled.

The idea is use a BrowseDialog where users can search by postal code, state, or any other of the fields there, once the found the desired record, when go back to the form this will fill the text boxes according to their selection. Is this possible with BrowseDialog?

Waiting for your valuable comments.

Regards.

Smile Everything is possible, just keep trying...

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search