FE Output template & TCL variable

QuyNguyenDai
QuyNguyenDai Altair Community Member
edited October 2020 in Community Q&A

Hi,

I'm looking a way to get the value of TCL variable from FE Output template.

In fact I would like to control template by using TCL variable, so my template has something like:

 

 *if([VALUE == 1])   ... *endif()  *if([VALUE != 1])   ... *endif() 

Where 'VALUE' comes from TCL variable.

Any idea?

 

TIA,

 

 

Tagged:

Answers

  • tinh
    tinh Altair Community Member
    edited November 2017

    Hi. The way I prefer to do is to put template codes in a tcl variable and use string map to change it, like this

    set TplCodes {your codes}

    set TplCodes [string map

    1. $TplCodes]
  • tinh
    tinh Altair Community Member
    edited November 2017

    Sorry I could not type it on phone

    set TplCodes {

         *if([VALUE == 1]) ... *endif() *if([VALUE != 1]) ... *endif()

    }

    set TplCodes1 [string map

    1.   $TplCodes]

    set TplCodes2 [string map

    1.   $TplCodes]

    ...

  • QuyNguyenDai
    QuyNguyenDai Altair Community Member
    edited November 2017

    Thanks. I'll test that.

  • tinh
    tinh Altair Community Member
    edited November 2017

    I could not type the code correctly. don't know reason

    format it by 'codes' is OK:

     set TplCodes {      *if([VALUE == 1]) ... *endif() *if([VALUE != 1]) ... *endif() } set TplCodes1 [string map [list VALUE $value1]  $TplCodes] set TplCodes2 [string map [list VALUE $value2]  $TplCodes]

     

  • QuyNguyenDai
    QuyNguyenDai Altair Community Member
    edited November 2017

    Thanks