Monday, August 17, 2015

Introduction to IDOC Script

- Server Side scripting language

- <!--$script--> syntex used in HCSP,HCSF files.

- <!--$variable = "Hello World" -->

- Six Basic uses of Idoc are Include, Variables, Functions, Conditions, Looping, Administration Interface (allows you to use Idoc Script in content server applets and customizations).

- Include :
Define Include : <!--@dynamichtml name@>code<!--@end@> / <@dynamichtml name@>code<@end@>
Include in page : <!--$IncludeName$-->
- Standard includes are defined in the <install_dir>/shared/config/resources/std_page.htm file.
- Body Defination example :
<@dynamichtml body_def@>
<body
<$if background_image$>
background="<$HttpImagesRoot$><$background_image$>"
<$elseif colorBackground$>
bgcolor="<$colorBackground$>"
<$endif$>

<$if xpedioLook$>
link="#663399" vlink="#CC9900"
<$else$>
link="#000000" vlink="#CE9A63" alink="#9C3000"
<$endif$>
marginwidth="0" marginheight="0" topmargin="0" leftmargin="0"
>
<@end@>

- Include in page : <$include body_def$> / <!--$include body_def -->

- Super Tag - The super tag is used to define exceptions to an existing include. The super tag tells the include to start with an existing include and then add to it or modify using the specified code.

- Component Defined :  <@dynamichtml my_resource@> <$a = 1, b = 2$> <@end@>

- Enhances the my_resource include using the super tag
<@dynamichtml my_resource@> <$include super.my_resource$> <!--Change "b" but not "a" --><$b = 3$> <@end@>

- Creating variables : <$variable_name$> / <!--$variable_name -->  (i.e : <!--$a=10 -->)
 Standard configuration variables are defined in the config/config.cfg file.
 Using commas as separators <$a=1,b=2$> / <!--$a=1,b=2 -->

- Referencing a Variable in a Conditional <$if variable_name$>

- Functions : Global Functions, Personalization Functions (utGetValue,utLoad,utLoadResultSet)

- Conditionals : <$if condition$> Statement; <$else$> Statement; <$elseif condition$> Statement; <$endif$>
Boolean Operators - and (<$if 3>2 and 4>3$>), or <$if 3>2 or 3>4$>, not (<$if not 3=4$>)

- Looping : For loop ( <$loop ResultSet_name$> Statement; <$endloop$> ), While Loop (<$loopwhile condition$> Statement; <$endloop$>).
<$break$> causes the innermost loop to be exited.

- Administration Interface : You can use Idoc Script in several areas of the administration interface, including:
Workflow Admin (page -14), Web Layout Editor (page -14), Batch Loader (page -15), Archiver (page -15), System Properties (page -15), Search Expressions (page -15), E-mail (page -15)

- Special Keywords : #active (<$#active.variable$>),  #local (<$#local.variable$>), #env (<$#env.variable$>),exec (<$exec expression$>),
include (<$include ResourceName$>), super (<$include super.<include>$>)

- Keywords and Functions : exec keyword (), eval function, include keyword, inc function

- Operators : Comparison Operators (==, !=, <, <=, >, >= ) , Special String Operators ( &, Like, | (<$if "car" like "car|truck|van"$>) )

- MetaData Fields : All internal metadata field names begin with either a “d” (Predefined field names begin with a “d”. For example, dDocAuthor) or an “x” (Custom field names begin with an “x”. For example, xDepartment.)

Idoc Scripting:

Include :
Define:
<@dynamichtml name@>
code
<@end@>
Include in page:
<$include name$>

Standard includes are defined in the : <install_dir>/shared/config/resources/std_page.htm file.

Variable:

<$variable_name$> as <$variable=value$> as <$i=0$>
i.e <$a=1,b=2$>
Functions:

onditions:

• <$if condition$>
• <$else$>
• <$elseif condition$>
• <$endif$>

<$if xDepartment$>
<td><$xDepartment$></td>
<$else$>
<td>Department is not defined.</td>
<$endif$>
<$xDepartment=""$>

Looping:

<$name="SearchResults"$>
<$loop name$>
<!--output code-->
<$endloop$>
Instead, you need to use the following code:
<$name="SearchResults"$>
<$rsFirst(name)$>
<$loopwhile getValue(name, "#isRowPresent")$>
<!--output code-->
<$rsNext(name)$>
<$endloop$>


<$QueryText="dDocType <matches> ‘ADACCT‘"$>
<$executeService("GET_SEARCH_RESULTS")$>
<table>
<tr>
<td>Title</td><td>Author</td>
</tr>


<$loop SearchResults$>
<tr>
<td><a href="<$SearchResults.URL$>">
<$SearchResults.dDocTitle$></a></td>
<td><$SearchResults.dDocAuthor$></td>
</tr>
<$endloop$>
</table>

<$loopwhile condition$>
code
<$endloop$>


<$abc=0$>
<$loopwhile abc<10$>
<$abc=(abc+2)$>
<$endloop$>

No comments:

AWS EC2 - SSH locked with UFW

Need to update the instance's user data: 1. Stop the instance 2. Right click (windows) or ctrl + click (Mac) on the instance to open a c...