Takashi7
Tera Contributor

Variable name definitions are stored in g_form.nameMap array.
The entity name of the form is required to identify the definition.
So you need to search g_form.nameMap by jvar_question_name.
Also, the default value can be obtained from jvar_question_value.

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
    <script>
        // 動的生成のフォーム名称(jvar_question_name)からカタログ定義本来の変数名を取得する
        function showVarName(value, controlName){
            // 実体名と変数名の対応が格納されているg_form.nameMapから実体名が一致する定義を取得する
            var nameMap = g_form.nameMap.filter( function(map){
                return map.realName == controlName;
                });
        	
            if(nameMap.length ==0)
                alert("definition not found");
                 
            // Result dialog
	        var msg = "value:     " + value
	        msg +=  "\nvar_name:  " + nameMap[0].prettyName;
	        msg +=  "\nvar_sysid: " + nameMap[0].questionID;
            alert(msg);
        }        
    </script>
    
    <j:set var="jvar_value" value="${jvar_question_value}" />      <!-- jvar_question_valueにdefault_valueが入ってくる -->
    <j:set var="jvar_control_id" value="${jvar_question_name}" />  <!--  動的に作られるform上の実体名を取得する(カタログとnavigaterで動き違う)-->

    <g:sc_button img="" classes="request_catalog_button header_button" 
    	 id="btnViewing" 
    	 label="View"
    	 title="View" 
    	 isPrimary="true"
    	 onclick="showVarName('${jvar_value}', '${jvar_control_id}');" 
    />
</j:jelly>
Comments
Padmini Dommeti
Kilo Contributor

HI,

 

I am having same requirement to display the vaiiable name dynamically on catalog item, The variable name type and value can be picked from a lookup table. DO you found a solution for this?

Version history
Last update:
‎07-05-2020 10:37 PM
Updated by: