Hi.
I want to share this library I wrote for quick prototyping database apps.
All data is hardcoded in to the library, no external files, you just add library as a reference and you are ready to go.
All fields contains 500 records of real people, addresses,etc. and source of data is free downloaded from the internet. (the lib do not require internet connection)
You have to keep it in mind that the only unsorted records across the fields match, but if you sort any field, it wont match , because there is no id that connects the data rows, but who cares, this is just example data for quick prototype.
There is 11 Fields in the library: First Name, Last Name, Company, Address,
City, Country, Postal Code, Phone1, Phone2, Email and Web address.
There is xml2bb:
DummyDataLibrary
Version: 1
Author: Jaames
Fields:
Example of usage:
Copy both fils DummyDataLibrary.jar and DummyDataLibrary.xml to your additional libraries folder, add DummyDataLibrary as a reference to your project and write next code :
Check your Log output and you should see the list of all "First Names" field sorted ascending
and list of Cities unsorted.
There are three attached zip files:
Have a good time!
Jaames
I want to share this library I wrote for quick prototyping database apps.
All data is hardcoded in to the library, no external files, you just add library as a reference and you are ready to go.
All fields contains 500 records of real people, addresses,etc. and source of data is free downloaded from the internet. (the lib do not require internet connection)
You have to keep it in mind that the only unsorted records across the fields match, but if you sort any field, it wont match , because there is no id that connects the data rows, but who cares, this is just example data for quick prototype.
There is 11 Fields in the library: First Name, Last Name, Company, Address,
City, Country, Postal Code, Phone1, Phone2, Email and Web address.
There is xml2bb:
DummyDataLibrary
Version: 1
Author: Jaames
Fields:
- SORT_ASCENDING As Int
- SORT_DESCENDING As Int
- SORT_NONE As Int
- GetAddresses (SortingMode As Int) As List
returns all the data Addresses sorted by the given SortingMode parameter
SORT_ASCENDING - will sort the data in ascending order
SORT_DESCENDING - will sort the data in descending order
SORT_NONE - will return unsorted data
- GetCities (SortingMode As Int) As List
returns all the data Cities sorted by the given SortingMode parameter
SORT_ASCENDING - will sort the data in ascending order
SORT_DESCENDING - will sort the data in descending order
SORT_NONE - will return unsorted data
- GetCompanies (SortingMode As Int) As List
returns all the data Companies sorted by the given SortingMode parameter
SORT_ASCENDING - will sort the data in ascending order
SORT_DESCENDING - will sort the data in descending order
SORT_NONE - will return unsorted data
- GetCountries (SortingMode As Int) As List
returns all the data Countries sorted by the given SortingMode parameter
SORT_ASCENDING - will sort the data in ascending order
SORT_DESCENDING - will sort the data in descending order
SORT_NONE - will return unsorted data
- GetDummyData (Data As String, SortingMode As Int) As List
returns all the data from selected Field
You can select which field you want by passing one of the string parameters:
FirstNames LastNames Companies Addresses Cities
Countries Postal Phones1 Phones2 Emails Webs
And you can sort the data by passing one of the SortingMode parameters:
SORT_ASCENDING - will sort the data in ascending order
SORT_DESCENDING - will sort the data in descending order
SORT_NONE - will return unsorted data
Example:
<code>Dim Data as DummyData
Dim l As List = Data.GetDummyData("FirstNames", Data.SORT_ASCENDING)
For x = 0 To Data.Size -1
Log(Data.Get(x))
Next</code>
You can access the fields also individually
- GetEmails (SortingMode As Int) As List
returns all the data Emails sorted by the given SortingMode parameter
SORT_ASCENDING - will sort the data in ascending order
SORT_DESCENDING - will sort the data in descending order
SORT_NONE - will return unsorted data
- GetFirstNames (SortingMode As Int) As List
returns all the data First Names sorted by the given SortingMode parameter
SORT_ASCENDING - will sort the data in ascending order
SORT_DESCENDING - will sort the data in descending order
SORT_NONE - will return unsorted data
- GetLastNames (SortingMode As Int) As List
returns all the data Last Names sorted by the given SortingMode parameter
SORT_ASCENDING - will sort the data in ascending order
SORT_DESCENDING - will sort the data in descending order
SORT_NONE - will return unsorted data
- GetPhones1 (SortingMode As Int) As List
returns all the data Phones1 sorted by the given SortingMode parameter
SORT_ASCENDING - will sort the data in ascending order
SORT_DESCENDING - will sort the data in descending order
SORT_NONE - will return unsorted data
- GetPhones2 (SortingMode As Int) As List
returns all the data Phones2 sorted by the given SortingMode parameter
SORT_ASCENDING - will sort the data in ascending order
SORT_DESCENDING - will sort the data in descending order
SORT_NONE - will return unsorted data
- GetPostal (SortingMode As Int) As List
returns all the data Postal sorted by the given SortingMode parameter
SORT_ASCENDING - will sort the data in ascending order
SORT_DESCENDING - will sort the data in descending order
SORT_NONE - will return unsorted data
- GetWebs (SortingMode As Int) As List
returns all the data Webs sorted by the given SortingMode parameter
SORT_ASCENDING - will sort the data in ascending order
SORT_DESCENDING - will sort the data in descending order
SORT_NONE - will return unsorted data
Example of usage:
Copy both fils DummyDataLibrary.jar and DummyDataLibrary.xml to your additional libraries folder, add DummyDataLibrary as a reference to your project and write next code :
B4X:
Dim DummyData As DummyData
Dim l As List = DummyData.GetFirstNames(DummyData.SORT_ASCENDING)
Log(l)
Log(DummyData.GetDummyData("Cities",DummyData.SORT_NONE))
Check your Log output and you should see the list of all "First Names" field sorted ascending
and list of Cities unsorted.
There are three attached zip files:
- DummyDataExample.zip - B4A example on how to use the lib.
- DummyDataJavaSource.zip the java sources of the lib, so you can extend it.
- Library.zip folder with compiled library (jar and xml) file.
Have a good time!
Jaames
Attachments
Last edited: