Skip to main content

Get-Custom-Template-Name

Command Description

Get template name from the custom template recognition result

Command Prototype

sRet = Mage.ExtractOCRTemplateName(jsonRet)

Parameter Description

ParameterRequiredTypeDefaultDescription
jsonRetTrueexpressionjsonRetUse the variable output to the "Screen Customer Template","Image Custom Template" command, such as the "PDF Custom Template" command, you need to use the value of traverse an array

return

sRet,The variable used to save the output of the command.

Demo

Dim jsonRet = {"ai_function" : "ocr_template","msgId" : "7bc9a3eb20922fd065b60eb4f934e573","page_number" : 1,"raw" : {"image_angle" : 0, "items" : [],"rotated_image_height" : 0,"rotated_image_width" : 0,"struct_content" : null,"tables" : []},"results" : [ {"field_name" : "student number","results" : ["2021005"]},{"field_name" : "name","results" : ["Sun Qi"]}, {"field_name" : "Gender","results" : ["Male"]},{"field_name" : "Exam Date","results" : ["2020.03.10"]} ,{"field_name" : "Grade","results" : ["Senior Grade"]},{"field_name" : "Chinese","results" : ["85"]} ,{"field_name" : "Math","results" : ["79"]},{"field_name" : "English","results" : ["85"]},{ "field_name" : "History","results" : ["75"]},{"field_name" : "Chemistry","results" : ["79"]}],"template_hash " : "AAAAAAAAAAAAAAAAAAAAAC2Thko=00","template_name" : "Result analysis","update_time" : "2021-08-31 12:20:53"}  // Test data 

TracePrint "--------------------Get custom template name--------------------"
// --------------------------------------------------------
// [Remarks] Get the custom template name
// Input parameters:
// jsonRet--template recognition result

// Output parameters:
// sRet--the variable to which the output of the function call is saved

// Command prototype: sRet = Mage.ExtractOCRTemplateName(jsonRet)
// --------------------------------------------------------

sRet = Mage.ExtractOCRTemplateName (jsonRet)
Traceprint (sRet)