Hello,
I’m trying to use a temporary table in 4D but after creating the table
successfully, "Is Table Number Valid" always returns, “Indice out of range”
when I try to use the new table number. If the client logs out and then back in
again, the table number is valid. Please see code below. Is there a workaround
for this? 4D v15 R4
Regards,
Mark
$tmp_table_name:="TempTable_4dt"
$fields:="Code Int32, Title VARCHAR(80), Name VARCHAR(80)"
// Create the temporary table
vSQL:="CREATE TABLE IF NOT EXISTS "+$tmp_table_name+" ("+$fields+")"
Begin SQL
EXECUTE IMMEDIATE :vSQL;
End SQL
If (OK=1)
FLUSH BUFFERS
// Get the new temp table's number and a pointer to it for later
$tmp_table_num:=Util_GetTableNum ($tmp_table_name)
// Check if we got a good table number.
If (Is table number valid($tmp_table_num))
// ***************************************** ERROR
************************************************
// Indice out of range error when trying to get the table number. The table
gets created but
// the client can't see it. If the client logs out and back in again, then the
table will be valid.
End if
End if
// ----------------------------------------------------
// Util_GetTableNum
If (Count parameters=1)
C_LONGINT($0;vNum_I)
C_TEXT($1;$table_name)
vNum_I:=0
$table_name:=$1
Begin SQL
SELECT TABLE_ID
FROM _USER_TABLES
WHERE TABLE_NAME = :$table_name
INTO :vNum_I
End SQL
$0:=vNum_I
End if
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************