C coldtech Member Licensed User Longtime User Sep 14, 2021 #1 I spent quite awhile yesterday trying to determine why my code kept exploding calling SetData. I did not properly create the columns and it was totally my overlooking it. However, would it be possible to check the Columns list in the CreateTable procedure to just return if the count is 0 or throw an exception in future versions? I found the 'CREATE TABLE" error thrown by the sql call to be very ambiguous.
I spent quite awhile yesterday trying to determine why my code kept exploding calling SetData. I did not properly create the columns and it was totally my overlooking it. However, would it be possible to check the Columns list in the CreateTable procedure to just return if the count is 0 or throw an exception in future versions? I found the 'CREATE TABLE" error thrown by the sql call to be very ambiguous.
M Mahares Expert Licensed User Longtime User Sep 15, 2021 #2 coldtech said: would it be possible to check the Columns list in the CreateTable procedure to just return if the count is 0 or throw an exception Click to expand... Until Erel gets back to you with a more plausible answer, you can always check the number of B4XTable columns before applying the data list to it: Code: Copy If B4XTable1.Columns.Size =0 Then MsgboxAsync("Did you forget to create the B4XTable Columns", "B4XTable columns may be missing") Return End If B4XTable1.SetData(Data) Or trap the error: Code: Copy Try B4XTable1.SetData(Data) Catch Log(LastException.Message) MsgboxAsync("Did you forget to create the B4XTable Columns", "B4XTable columns may be missing") End Try
coldtech said: would it be possible to check the Columns list in the CreateTable procedure to just return if the count is 0 or throw an exception Click to expand... Until Erel gets back to you with a more plausible answer, you can always check the number of B4XTable columns before applying the data list to it: Code: Copy If B4XTable1.Columns.Size =0 Then MsgboxAsync("Did you forget to create the B4XTable Columns", "B4XTable columns may be missing") Return End If B4XTable1.SetData(Data) Or trap the error: Code: Copy Try B4XTable1.SetData(Data) Catch Log(LastException.Message) MsgboxAsync("Did you forget to create the B4XTable Columns", "B4XTable columns may be missing") End Try
C coldtech Member Licensed User Longtime User Sep 15, 2021 #3 Mahares said: Until Erel gets back to you with a more plausible answer, you can always check the number of B4XTable columns before applying the data list to it: Code: Copy If B4XTable1.Columns.Size =0 Then MsgboxAsync("Did you forget to create the B4XTable Columns", "B4XTable columns may be missing") Return End If B4XTable1.SetData(Data) Or trap the error: Code: Copy Try B4XTable1.SetData(Data) Catch Log(LastException.Message) MsgboxAsync("Did you forget to create the B4XTable Columns", "B4XTable columns may be missing") End Try Click to expand... I know, but when a new version of the lib ships it would be nice to not have to remember to reimplement. Another option would be to show the grid with a single row/column "NO DATA DEFINED", which is what I would do for my application.
Mahares said: Until Erel gets back to you with a more plausible answer, you can always check the number of B4XTable columns before applying the data list to it: Code: Copy If B4XTable1.Columns.Size =0 Then MsgboxAsync("Did you forget to create the B4XTable Columns", "B4XTable columns may be missing") Return End If B4XTable1.SetData(Data) Or trap the error: Code: Copy Try B4XTable1.SetData(Data) Catch Log(LastException.Message) MsgboxAsync("Did you forget to create the B4XTable Columns", "B4XTable columns may be missing") End Try Click to expand... I know, but when a new version of the lib ships it would be nice to not have to remember to reimplement. Another option would be to show the grid with a single row/column "NO DATA DEFINED", which is what I would do for my application.