B4J Question [BANano] [SOLVED] For Each Loop Data Type

Mashiane

Expert
Licensed User
Longtime User
Hi there

Please see line 149: It seems if you don't specify a data type for the loop item, it does not transpile. Having strfield As String however works perfectly.

B4X:
// [146] Sub DropColumns(tblName As String, fields As List) As List
this.dropcolumns= function(_tblname,_fields) {
if (self==null) self=this;
var _lst;
var _strcommand;
// [147]  Dim lst As List
_lst=[];
// [148]  lst.Initialize
_lst.length=0;
// [149]  For Each strfield In fields
;
// [150]  Dim strcommand As String = {14}
_strcommand="ALTER TABLE [" + _tblname + "] DROP COLUMN [" + %strfield% + "]";
// [151]  lst.Add(strcommand)
_lst.push(_strcommand);
// [152]  Next
}
// [153]  Return lst
return _lst;
// End Sub
};
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…