User error: you MUST NOT call AddColumn/AddTextColumn conditionally

I want to add TBond prices to an exploration in their native format (i.e 169'160). I created a string for this but when I show it with AddTextColumn() it adds the thousand separator that I don't want. I dont see a way to remove it:

StringBonos = "169'160"; 
if (Name() == "&ZB_CCB")
	{
		AddTextColumn(StringBonos, "Price",1, ColorDefault, ColorDefault,30);
	}

c39

I have read the documentation and I know that I can use NumToStr() with separator = false, but It is the AddTextColumn that adds it inmediately before showing it. I have also tried to remove it from "Tools|Preferences|Miscellaneous" but it doesn't work.

I guess it is a problem that can be fixed with StrFormat() but I don't know much about formats and after trying I am unable to present it correctly. Thanks

Don't call AddTextColumn conditionally. That is source of your problems. AddTextColumn
MUST BE OUTSIDE any if(). Instead you can set the text conditionally, but column MUST EXIST all the time.

if( Name() == "&ZB_CCB" ) 
  text = "169'160";
else
  text = "";
  
// column must be added UNCONDITIONALLY because columns are 
// common for ALL output lines !!!!
AddTextColumn(text, "Price",1, ColorDefault, ColorDefault,30);
Filter =1;
3 Likes

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.