How to store CLOB variable data to the table through webservice

By | September 18, 2020

CLOB stands for Character Large Object, CLOB stores large amounts of character data ,up to 4GB in size. CLOB data may be very large, some database management systems do not store the text directly in the table. Instead, the CLOB field serves as an address, which references the location of the data.

New Stuff:- How to increase no. of characters in Line text entry using import template

How to address CLOB in X3 Script file and Screen, tables and reports:

In X3,Clbfile is the keyword used to declare the variables of the type CLOB.

Syntax:

          Local Clbfile Name_of_the_Variable(Length)

          Local Clbfile Name_of_the_Variable(Length)(Dimensions)

Example:

          Local Clbfile YMYCLOB(200)

          Local Clbfile YMYCLOB(200)(1..10)

          Dimension: having index range 1 to 10

In X3 ,ACB is the data types that can be used in all the dictionaries where the CLOB data is defined  in screen fields, table fields, report setups, etc.

ACB data type stores the information more than 250 characters in the database.

When saving file date to the field of table if you find any “Text file length too long error”, then declare the field as ACB to rectify the error.

Create Subprogram based Web service:

STEP 1: Create a script with subprogram for storing input data to the table.

Create a table named YCLOBTAB with following fields

S.No

Name of the Field

Datatype

Length

1

YLEG

A

10

2

YFILENAM

A

50

3

YFILESTR

ACB

 

4

YSTA

A

50

Click on Create and Validate the table in X3.

Create the Script file name: YSAVEENCRYPT and write the subprogram below:

Subprog  YSAVECLOB(YLEG,YFILENAM,YFILESTR,YSTA) 

Value    Char     YLEG

Value    Char     YFILENAM

Value    Clbfile   YFILESTR

Variable Char     YSTA

##OPENING Table for storing CLOB data FILE

If !clalev([F:YCLB]) Local File YCLOBTAB[F: YCLB] :Endif

####ERROR HANDLING

ONERRGO YCATCH

         [F: YCLB]YLEG           = YLEG

          [F: YCLB]YFILENAM = YFILENAM

          [F: YCLB]YFILESTR  = YFILESTR

          WRITE[F: YCLB]

          YSTA = “SUCCESS”

ONERRGO

#####

Close File[F: YCLB]

End

## ERROR HANDLING CATCH METHOD

$YCATCH

   YSTA = “FAIL”

Resume

STEP 2: Create Subprograms by referring script file and subprogram created on step 1

Navigational Path: Development>Script dictionary>Subprograms.

Creating Subprograms
Creating Subprograms

Enter the Script file name in File field “YSAVEENCRYPT”

Enter the subprogram name in Subprograms field “YSAVECLOB”

Enter the appropriate description in Description field “Save CLOB data”

Then click on Create button, then publication button gets enabled then click on publication button to create web service.

Creating Webservices
Creating Webservices

STEP 4:Invoking the Web service by XML input

For Invoking Webservices, Please refer the blog “How to invoke Import/Export Template through Webservices”

Place the below XML in  Input XML/JSON field

<PARAM>

<GRP ID=”GRP1″>

<FLD NAM=”YSLEG”  TYP=”Char”>AUS</FLD>

<FLD NAM=”YSFILENAM”  TYP=”Char”>FIL002</FLD>

<FLD NAM=”YSFILESTR”  TYP=”Clob”>

hQEMA/KwatWd7FffAQf/Zh/GVgozLWaVOVzVrJT9KZvjJ0QKs4p698zA2oCb9LhK

QRprExhgALKZp7qdtnK5LRC9P1VNt0lKduZ23BjxXWlaxY5V+TwxdAcVXEonWhB2

3SbK9wDjgB1w0zItOC+dz5TEYvzXJMlb9mGqVKwVWqRYYaKgjg3AHF4+iu4VSUns

sImvvOvnNDQ/3KPX3NE3F3RS9XeTajU4zozbYkry+mcxGbj9wAsNASMLWqBTb2sN

NGG5EAqkqTBxsIbHv+m5J8GZbpTrJgIkiek+shVrH0nNnIGyz6I7bedxIupFY5xQ

lYAuupvuIuSK4DcOuiXazUvKx81kSFGvKTnsadMCcsnBHaOE6dEW9crEd5itDsWE

yJflofoO2WR7B1vQ5O2Vd8pBLJ7xxtt3SVzQToO4921wRd99BROeMfUDVLXwqR5/

AGUbyw+Y383AFSfdjYvxK2XSW3Fit6JVNZ1SqXVVuMzpyA9+nchkffzL4WiI+p7m

I7VnuAjrltUqTcC+7cd1viTVcH6GD9liaElQnbwVJt12FYOe0JYio9FWOdFPBeIJ

Vhm0RjPm/fDffbGhPm/mzkbhJLskRFXek1e//wt9SEmSgJ6U/erYerfxwOYPDE2n

y3qrP7Kz5ROQn15cU8Fh8zoTBJT53pvAH6GFvpzoQoPyv35Oy1YWulHTRkWoCRoG

kJVbvL2pUftyxZBWc1tufQKZ9VO7s+WqiS1BJWvwj2U1JdbLgbt+1mQXU+T86KHg

xfKTjMBnjZFLKXJxvyn+efx6zfQ5EDiaw7SmsLoQe4stA9RHQcYRuN0UAGR4qxVS

Lm6QAPQImLnz+17Uqt449w5s9OEOlRAva+6aN9tJmp+roeQOT813Mn6BPz51KX65

/gbPUDRgPp30NQsEDbqusrqLVCCEikYGwLteNNShbz2+IR1mDtsEsDsRFJPNOaaL

t05eLvB4DPjCZWL27lKkOXMeXuj3kzYdXDVyl0YHyw===Z1hp

</FLD>

<FLD NAM=”YSTA”  TYP=”Char”></FLD>

</GRP>

</PARAM>

The field YSFILESTR contains more than 255 characters.

STEP 5: Response after invoking Web services

<RESULT>

<GRP ID=”GRP1″>

<FLD NAME=”YSLEG” TYPE=”Char”>AUS</FLD>

<FLD NAME=”YSFILENAM” TYPE=”Char”>FIL002</FLD>

<FLD NAME=”YSFILESTR” TYPE=”Clob”>hQEMA/KwatWd7FffAQf/Zh/GVgozLWaVOVzVrJT9KZvjJ0QKs4p698zA2oCb9LhK QRprExhgALKZp7qdtnK5LRC9P1VNt0lKduZ23BjxXWlaxY5V+TwxdAcVXEonWhB2 3SbK9wDjgB1w0zItOC+dz5TEYvzXJMlb9mGqVKwVWqRYYaKgjg3AHF4+iu4VSUns sImvvOvnNDQ/3KPX3NE3F3RS9XeTajU4zozbYkry+mcxGbj9wAsNASMLWqBTb2sN NGG5EAqkqTBxsIbHv+m5J8GZbpTrJgIkiek+shVrH0nNnIGyz6I7bedxIupFY5xQ lYAuupvuIuSK4DcOuiXazUvKx81kSFGvKTnsadMCcsnBHaOE6dEW9crEd5itDsWE yJflofoO2WR7B1vQ5O2Vd8pBLJ7xxtt3SVzQToO4921wRd99BROeMfUDVLXwqR5/ AGUbyw+Y383AFSfdjYvxK2XSW3Fit6JVNZ1SqXVVuMzpyA9+nchkffzL4WiI+p7m I7VnuAjrltUqTcC+7cd1viTVcH6GD9liaElQnbwVJt12FYOe0JYio9FWOdFPBeIJ Vhm0RjPm/fDffbGhPm/mzkbhJLskRFXek1e//wt9SEmSgJ6U/erYerfxwOYPDE2n y3qrP7Kz5ROQn15cU8Fh8zoTBJT53pvAH6GFvpzoQoPyv35Oy1YWulHTRkWoCRoG kJVbvL2pUftyxZBWc1tufQKZ9VO7s+WqiS1BJWvwj2U1JdbLgbt+1mQXU+T86KHg xfKTjMBnjZFLKXJxvyn+efx6zfQ5EDiaw7SmsLoQe4stA9RHQcYRuN0UAGR4qxVS Lm6QAPQImLnz+17Uqt449w5s9OEOlRAva+6aN9tJmp+roeQOT813Mn6BPz51KX65 /gbPUDRgPp30NQsEDbqusrqLVCCEikYGwLteNNShbz2+IR1mDtsEsDsRFJPNOaaL t05eLvB4DPjCZWL27lKkOXMeXuj3kzYdXDVyl0YHyw== =Z1hp</FLD>

<FLD NAME=”YSTA” TYPE=”Char”>SUCCESS</FLD>

</GRP>

</RESULT>

This blog helps us to understand what is CLOB, what is the keyword used in script and database in X3 and how to store the CLOB data to the table using subprogram based web service.

About Us

Greytrix – a globally recognized and one of the oldest Sage Development Partners is a one-stop solution provider for Sage ERP and Sage CRM organizational needs. Being acknowledged and rewarded for multi-man years of experience and expertise, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third-party add-on development, and implementation competence.

Greytrix has some unique integration solutions developed for Sage CRM with Sage ERPs namely Sage X3Sage IntacctSage 100Sage 500, and Sage 300. We also offer best-in-class Sage ERP and Sage CRM customization and development services to Business Partners, End Users, and Sage PSG worldwide. Greytrix helps in the migration of Sage CRM from Salesforce | ACT! | SalesLogix | Goldmine | Sugar CRM | Maximizer. Our Sage CRM Product Suite includes addons like  Greytrix Business Manager, Sage CRM Project Manager, Sage CRM Resource Planner, Sage CRM Contract Manager, Sage CRM Event Manager, Sage CRM Budget Planner, Gmail Integration, Sage CRM Mobile Service Signature, Sage CRM CTI Framework.

Greytrix is a recognized Sage Champion Partner for GUMU™ Sage X3 – Sage CRM integration listed on Sage Marketplace and Sage CRM – Sage Intacct integration listed on Sage Intacct Marketplace. The GUMU™ Cloud framework by Greytrix forms the backbone of cloud integrations that are managed in real-time for the processing and execution of application programs at the click of a button.

For more information on our integration solutions, please contact us at sage@greytrix.com. We will be glad to assist you.