JsonTemplateReplacePlaceholder

 

The JsonTemplateReplacePlaceholder function registers the value in a changelist to change the placeholder value of the JSON template.

The registered placeholder value is changed all at once when you run the @JsonTemplateReplaceDone function.

 

int @JsonTemplateReplacePlaceholder(string templateId, string placeholder, object value);

int @JsonTemplateReplacePlaceholder(string templateId, string placeholder, object value, string dataType);

 

Parameters

string tempateId               : Template ID to load

string placeholder            : Replace Placeholder strings ( eg. "#NAME#")

object value                       : Values to set

string dataType                 : The data type of the value, "string" when not filled in

 "string" : string

  "int", "long" : integer

  "float", "double", "decimal" : real value

  "bool" : Boolean Value

  "datetime" : Date/Time (can be formatted as "datetime:yyyy-MM-dd")

  "null" : null

  

Return Values

1 : Success

0 : Failure

 

Example )

string templateID = "template1";
string templateString = @JsonTemplateLoad(templateID);
// Load the JSON template saved as template1. The templateString variable returns the template default value.


@JsonTemplateReplacePlaceholder(templateID , "#NAME#", "Hong Gil-dong", "string");     // Change the placeholder written as #NAME# to the string "Hong Gil-dong".
@JsonTemplateReplacePlaceholder(templateID , "#AGE#", 20, "int");     // Change the placeholder written as #AGE# to the integer 20.
templateString = @JsonTemplateReplaceDone(templateID);                     // Apply the registered placeholder values to the JSON template.


@JsonTemplateTagSet(templateString);                 // Change all tag placeholders written as #$AI_0000# to the current tag values.
@JsonTemplateReplaceMissing(templateString); // Replace remaining placeholders (#OOO#) with null.
@ObjectSetText("Text1", templateString);             // Display the final JSON template string in the Text1 text element.

 

Version information

Supported Version: 10.3.6.25 or later

 

Related Helps)

JsonStructNew

JsonAppend

JsonSet

JsonToString

JsonClear

JsonGet

JsonFromString

JsonSetValue

JsonGetValue

JsonClearAll

JsonStringGetValue

JsonStringSetValue

JsonTemplateLoad

JsonTemplateReplacePlaceholder

JsonTemplateReplaceDone

JsonTemplateReplaceMissing

JsonTemplateTagSet