Cancel
Showing results for 
Search instead for 
Did you mean: 

Empty cells in tables with data type Integer

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor

Hello, me again. Is it becoming clear I'm developing something?

 

Are you already aware that empty cells of data type integer in tablefiles are returning a void value?

They used to return 0 (zero)

I already fixed the loop to avoid void values but it used to work better the other way.

 

Regards,

cortega@interlatin.com.mx
+52 (81) 10801310
InterLatin S de RL de CV
3 REPLIES

Re: Empty cells in tables with data type Integer

Siemens Phenom Siemens Phenom
Siemens Phenom

We changed this intentionally.

 

It was always confusing for beginners that comparing an empty cell with VOID returned true, but reading out the content of an empty cell did not return VOID.

For example:

TableFile[1,1] := void       -- make the cell empty
print TableFile[1,1] = void -- prints true print TableFile[1,1] -- prints 0 for an empty integer cell

 

The main reason we changed this, is that we think it will help you to find bugs in your SimTalk code. In SimTalk 1.0 it was hard to find out that you accidentally read out an empty cell. You had to explicitly set the number of columns and rows, if you wanted to get an error when you read beyond the list dimensions. This is impracticable if you dynamically add and delete rows. Even if the dimension is fixed, it still can happen that you accidentally read out a table that has not yet been filled.

 

So we decided that in SimTalk 2.0 you have to set the cell to 0 if you want the cell to return 0. That does not sound odd, right?

There is just one exception for this rule. An empty cell of the data type string returns the empty string "" instead of VOID. The reason is, that it is impossible to interactively enter an empty string into a table. The cell will always become VOID instead. In addition, the data type string is the only data type that has a value (the empty string) that cannot visually be distinguished from VOID (except if you activate the ribbon button "Highlight Empty Cells").

_________________________________________________________________
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: Empty cells in tables with data type Integer

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor
Understood,

Sounds fair and is not that difficult to adapt the code.

Thanks,
cortega@interlatin.com.mx
+52 (81) 10801310
InterLatin S de RL de CV

Re: Empty cells in tables with data type Integer

Siemens Phenom Siemens Phenom
Siemens Phenom

The upcoming version 12.2 will have a SimTalk 1.0 to SimTalk 2.0 converter that you can use to automatically convert the source code into the new syntax. This converter actually works quite well, but the behavior change for empty table cells turned out to be problematic. So, in order to improve the compatibility / portability, we decided that in version 12.2 we go back to the old SimTalk 1.0 behavior, i.e. empty table cells return the default value in SimTalk 2.0 Methods too.

_________________________________________________________________
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.