Other Challenge for library developers B4A

Sergio Haurat

Active Member
Licensed User
Longtime User
On Visual Basic .net, I can do this:

B4X:
Dim dtTemp as New DataTable
Dim col1 As DataColumn
Dim col2 As DataColumn
col1 = New DataColumn
col2 = New DataColumn
col1.DataType = System.Type.GetType("System.String")
col1.ColumnName = "dtTemp_id"
col2.DataType = System.Type.GetType("System.String")
col2.ColumnName = "dtTemp_desc"
dtTemp.Columns.Add(col1)
dtTemp.Columns.Add(col2)
For Each drList As DataRow In drFilter
  dtTemp.Rows.Add(drList(0), IIf(drList(2).ToString = String.Empty, drList(1), drList(2) & " - " & drList(1)))
Next

The DataTable object has many properties such as:
* Read data from a text file, XML, etc..
* It can index at runtime any field
* You can filter
* You can attach the object to almost anything

Example:

B4X:
Me.cmbMerca.DataSource = dtTemp
Me.cmbMerca.DisplayMember = "dtTemp_desc"
Me.cmbMerca.ValueMember = "dtTemp_id"

These three lines, fill a combo with an ID, to know what was selected and a text, which is what the user sees.


This is a real need because for example:

The SQL library returns a value of type Cursor
The MySQL library returns a value type List

Now I need to combine these values and later an XML or text file. To do this, I'll have to "invent" intermediate functions cycles For / Next. The Cursor see Columns, but for List, the first row is the column.

Some believe that the possibility of doing something about this programming language?.

Sorry if not well understood my English, I am using Google Translate Spanish> English
Lamento mucho si no se entiende bien mi inglés, estoy utilizando el traductor de Google Español > Inglés
 

Sergio Haurat

Active Member
Licensed User
Longtime User
Erel, deeply appreciate your patience. You're always there to help us. I saw your comments, especially the MySQL library, if you check my browsing on the forum, you'll see that I explore all subjects that relate to my concern.

This may solve the interaction between two databases, in this case, SQLite and MySQL or other. But if you need to read an XML or a text file, there will be complicated.

For this reason I propose to generate an object that can read various types of data that have a relationship with columns and records.
 
Upvote 0

Sergio Haurat

Active Member
Licensed User
Longtime User
How I can convert a variable type List in a variable type Cursor? Exists CType or Cast?

.net example:

B4X:
Dim obj As MaskedTextBox = CType(sender, MaskedTextBox)
obj.Text = "Hello!"

Generic Example

B4X:
Dim asd As SQL
asd.Initialize2(data As List)
 
Last edited:
Upvote 0
Top