B4J Question Help Converting From Old B4XTable Class Module to Library

MrKim

Well-Known Member
Licensed User
Longtime User
As always, thanks in advance for any help.

I found the time to resurrect an old project that has has (had) a lot of code that was working very nicely. I am using the B4xTable class module and thought I would switch to the newer B4Xtable Lib. Needless to say my code blew up in a hundred places.

I am wondering if someone can quickly show me how to change the code to the new equivalents and save me endless hours of experimentation..
Or perhaps it is not even worth my time? I should just use as is? This will be a B4J only project.

Below are some of the examples that blew up.

B4X:
Private PMPicFile As B4XTableColumn
.
PMPicFile = MyB4XTable.AddColumn("PMPicFile", "PMP_Name", 0, 0, UnSchedOpsList.COLUMN_TYPE_TEXT)
Too Many Parameters.
This is the help for the old version
1650366374935.png

Here are more. For brevity I am just posting screenshots. If you want the code let me know and I will add it.
UnSchedOpsList is the B4XTable
1650366637635.png

Was:
1650366860205.png

--
1650367003728.png

Was:
1650367122984.png

--
1650367300287.png

--
HotJr_ReleasedCol is a B4XTableColumn, B4XStringFormatter is another Class module
1650367954933.png

Was:
1650368015072.png


StrFormatter failing is causing all of the following to fail.:
    Dim HJ As B4XStringFormatter
    HJ.Initialize
    HotJr_ReleasedCol.StrFormatter = HJ
    Dim HotJob As B4XFormatStringData = HotJr_ReleasedCol.StrFormatter.NewFormatData
    HotJob.BackColor = xui.Color_Red
    HotJob.FormatFont = xui.CreateDefaultBoldFont(UnSchedOpsList.LabelsFont.Size)
    HotJob.SearchType = HJ.SEARCH_TYPE_EQUALS
    HotJob.RangeStart = "Hot"
    HotJob.RangeEnd = "Hot"
    HJ.FormatFieldName = "Os_JobNum"
    HotJr_ReleasedCol.StrFormatter.AddFormatData(HotJob, HJ.SEARCH_TYPE_EQUALS, True, True)
 

Attachments

  • 1650366807725.png
    1650366807725.png
    4 KB · Views: 130
  • 1650366936117.png
    1650366936117.png
    12.8 KB · Views: 126
  • 1650367632703.png
    1650367632703.png
    7.3 KB · Views: 120

LucaMs

Expert
Licensed User
Longtime User
They are the same methods and properties, nothing has changed (based on what I see in the images you posted).

Have you really selected the B4XTable library? Is it in the right folder (the B4J internal)?

1650370173624.png


[Erel, 1.22 -> 1.21]
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
They are the same methods and properties, nothing has changed (based on what I see in the images you posted).

Have you really selected the B4XTable library? Is it in the right folder (the B4J internal)?

View attachment 128109

[Erel, 1.22 -> 1.21]
See below. I hope you are right. Do I need JTableViewExtended? I don't have that
1650370650210.png
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
Are there any other warnings or error messages?
B4X:
MachinesFrmMod - 920: Unknown member: deleterow
Main - 987: Unknown member: selectedrownumber
Main - 1012: Unknown member: getcoldata
Main - 1011: Unknown member: getcoldata
Main - 711: Unknown member: minwidth
Main - 697: Unknown member: strformatter
Main - 695: Unknown member: rangeend
Main - 694: Unknown member: rangestart
Main - 693: Unknown member: searchtype
Main - 692: Unknown member: formatfont
Main - 691: Unknown member: backcolor
Main - 690: Unknown member: strformatter
Main - 689: Unknown member: strformatter
Main - 685: Unknown member: dateformatter
Main - 684: Unknown member: formatfont
Main - 683: Unknown member: backcolor
Main - 682: Unknown member: textcolor
Main - 681: Unknown member: dateformatter
Main - 680: Unknown member: dateformatter
Main - 672: Too many parameters.
Main - 671: Too many parameters.
Main - 669: Too many parameters.
Main - 668: Too many parameters.
Main - 667: Too many parameters.
Main - 666: Too many parameters.
Main - 665: Too many parameters.
Main - 663: Too many parameters.
Main - 662: Too many parameters.
Main - 661: Too many parameters.
Main - 660: Too many parameters.
Main - 659: Too many parameters.
Main - 658: Too many parameters.
Main - 657: Too many parameters.
Main - 656: Too many parameters.
Main - 655: Too many parameters.
Main - 654: Too many parameters.
Main - 653: Too many parameters.
Main - 652: Too many parameters.
Main - 650: Too many parameters.
Main - 648: Too many parameters.
Main - 682: Undeclared variable 'hasaf'. (warning #8)
Main - 691: Undeclared variable 'hotjob'. (warning #8)
Main - 625: Unreachable code detected. (warning #1)
Main - 841: Unreachable code detected. (warning #1)
MachinesFrmMod - 412: Object converted to String. This is probably a programming mistake. (warning #7)
MachinesFrmMod - 782: Object converted to String. This is probably a programming mistake. (warning #7)
MachinesFrmMod - 246: Unused variable 'SqlTxt'. (warning #9)
Main - 312: Sub 'GetCount' is not used. (warning #12)
MachinesFrmMod - 245: Sub 'ShowLoadGraphs' is not used. (warning #12)
Main - 81: Layout file 'CurrentJob.bjl' is not used. Are you missing a call to MainForm.RootPane.LoadLayout? (warning #16)

But I believe most of these are related to the failure of the other ones.

I have B4XTable Class and everything works (errors starting at Main - 625: Unreachable are there - stuff I haven't cleaned up yet.)
I add B4XTable Lib and Delete the class and it fails with everything you see above.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Indeed those members are not part of B4XTable.
I found a B4XTable class created on January 20, 2020 and it doesn't have those members either.
I also searched for them using Google Search but only on the B4X.com site: nothing.

Search your project for one of them, for example: getcoldata; in which module do you find it?
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
Indeed those members are not part of B4XTable.
I found a B4XTable class created on January 20, 2020 and it doesn't have those members either.
I also searched for them using Google Search but only on the B4X.com site: nothing.

Search your project for one of them, for example: getcoldata; in which module do you find it?
B4xTable Class:
B4X:
Public Sub GetColData(Row As Int, Col As String) As String
    Return sql1.ExecQuerySingleResult("SELECT " & Col & " FROM data WHERE rowid = " & Row & ";")

End Sub
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
Search your project for one of them, for example: getcoldata; in which module do you find it?
getcoldata is in The B4xTable Module.

It really isn't that important to me to dig out the source, I was just hoping someone could easily tell me how to work around the changes.
 
Upvote 0
Top