foreach em campos da tela

Pessoal tenho a necessidade de realizar um foreach em todos os campos da minha tela para utilizar o sc_field_display de forma dinâmica.
O exemplo abaixo não está funcionando pois o array $CAMPOS não armazena o nome dos campos corretamente devido um tratamento interno do sc nem se forem colocados entre aspas. Alguém sabe uma forma de realizar isso?

Exemplo:

$CAMPOS = array({ST},{ID_CIDADAO},{NOME},{DATANASCIMENTO},{STATUS},{SITUACAO},{FUNCIONARIO});

if ({SITUACAO} == ‘CIDADAO DESCONHECIDO’ and {CLIENTE} != [CLIENTE_ID] ){

foreach ($CAMPOS as $CAMPOFF){
		sc_field_display($CAMPOFF, off);		
};

} else {

foreach ($CAMPOS as $CAMPON){
	sc_field_display($CAMPON, on);
};	

}

Xará,
Testa assim:
$CAMPOS = array(“ST”,“ID_CIDADAO”,“NOME”,“DATANASCIMENTO”,“STATUS”,“SITUACAO”,“FUNCIONARIO”);

if ({SITUACAO} == ‘CIDADAO DESCONHECIDO’ and {CLIENTE} != [CLIENTE_ID] ){

foreach ($CAMPOS as $CAMPOFF){
sc_field_display($CAMPOFF, off);
};

} else {

foreach ($CAMPOS as $CAMPON){
sc_field_display($CAMPON, on);
};
}

[]s

Tentei dessa forma mas não funcionou.

Não dá pra vc colocar todos esses campos em um único bloco e ocultar o bloco inteiro?

Esconder um bloco com muitos campos, cria um efeito indesejável, pois o SC ao carregar a aplicação exibe os campos e depois vai escondendo até esconder o bloco, e isso, de forma visível ao usuário:

Uma forma de esconder campos dinamicamente é:

foreach ($this->Ini->_field[$_block] as $k => $v) { $this->nmgp_cmp_hidden[$v] = $_value; $this->NM_ajax_info['fieldDisplay'][$v] = $_value; }

onde $this->Ini->_field[$_block] é um array com todos os campos que deseja esconder.

mas no evento onscriptinit deve-se carregar todos os campos no array, como segue o exemplo:

[code]$this->Ini->_field[“none”][‘consulta’]=“consulta”;

$this->Ini->_block[“atividades”]=4;
$this->Ini->_block[“despesas”]=5;
$this->Ini->_block[“horas_menu”]=6;
$this->Ini->_block[“horas”]=7;
$this->Ini->_block[“anotacoes”]=8;
$this->Ini->_block[“pecas”]=9;

$this->Ini->_field[“5”][‘desp_tipo’]=“desp_tipo”;
$this->Ini->_field[“5”][‘desp_valor’]=“desp_valor”;

$this->Ini->_field[“7”][‘horas_label1’]=“horas_label1”;
$this->Ini->_field[“7”][‘horas_desl_ida’]=“horas_desl_ida”;
$this->Ini->_field[“7”][‘horas_desl_volta’]=“horas_desl_volta”;
$this->Ini->_field[“7”][‘horas_label2’]=“horas_label2”;
$this->Ini->_field[“7”][‘horas_prod_se’]=“horas_prod_se”;
$this->Ini->_field[“7”][‘horas_prod_cc’]=“horas_prod_cc”;
$this->Ini->_field[“7”][‘horas_label3’]=“horas_label3”;
$this->Ini->_field[“7”][‘horas_prod_sc’]=“horas_prod_sc”;
$this->Ini->_field[“7”][‘horas_prod_ce’]=“horas_prod_ce”;
$this->Ini->_field[“7”][‘horas_label4’]=“horas_label4”;
$this->Ini->_field[“7”][‘horas_ref_de’]=“horas_ref_de”;
$this->Ini->_field[“7”][‘horas_ref_ate’]=“horas_ref_ate”;
$this->Ini->_field[“7”][‘horas_label5’]=“horas_label5”;
$this->Ini->_field[“7”][‘horas_interrup_i’]=“horas_interrup_i”;
$this->Ini->_field[“7”][‘horas_interrup_f’]=“horas_interrup_f”;
$this->Ini->_field[“7”][‘horas_inprod_mot’]=“horas_inprod_mot”;
$this->Ini->_field[“7”][‘horas_cobra’]=“horas_cobra”;
$this->Ini->_field[“7”][‘horas_label6’]=“horas_label6”;
$this->Ini->_field[“6”][‘horas_menu’]=“horas_menu”;

$this->Ini->_field[“4”][‘ativ_tiposervico’]=“ativ_tiposervico”;
$this->Ini->_field[“4”][‘ativ_horas’]=“ativ_horas”;
$this->Ini->_field[“4”][‘ativ_servexecutado’]=“ativ_servexecutado”;

$this->Ini->_field[“8”][‘anotacoes_tipo’]=“anotacoes_tipo”;
$this->Ini->_field[“8”][‘anotacoes_nota’]=“anotacoes_nota”;

$this->Ini->_field[“9”][]=“Pecas_Item”;
$this->Ini->_field[“9”][]=“Pecas_ItemDesc”;
$this->Ini->_field[“9”][]=“Pecas_PartNumb”;
$this->Ini->_field[“9”][]=“Pecas_PartNumbDesc”;
$this->Ini->_field[“9”][]=“Pecas_Quantidade”;
$this->Ini->_field[“9”][]=“Pecas_Altura”;
$this->Ini->_field[“9”][]=“Pecas_Largura”;
$this->Ini->_field[“9”][]=“Pecas_Comprimento”;
$this->Ini->_field[“9”][]=“Pecas_Peso”;
$this->Ini->_field[“9”][]=“Pecas_Defeito”;
$this->Ini->_field[“9”][]=“Pecas_DataSol”;
$this->Ini->_field[“9”][]=“Pecas_MotEN”;
$this->Ini->_field[“9”][]=“Pecas_MotPT”;
$this->Ini->_field[“9”][]=“Pecas_Obs”;
$this->Ini->_field[“9”][]=“Pecas_Und”;[/code]