Thursday, March 13, 2008

Create a unique list with only few members unique in Graphtalk

Here we would like to make a unique list, be considering just the second and the fourth members. This code can be customised for any such subset
Copy paste the below code(with customisation)!!!
A <=> [
[
$contract:p_ci_std$Ge3T,
"5000001914",
$event:p_evt_financial$1QtRh,
75632,
75638
],
[
$contract:p_ci_std$THYW,
"5000046615",
$event:p_evt_financial$1QtRg,
75635,
75642
],
[
$contract:p_ci_std$THYW,
"5000046615",
$event:p_evt_other$1gI6N,
75635,
75635
],
[
$contract:p_ci_std$CR2Q,
"5000000274",
$event:p_evt_financial$1gI6O,
75631,
75631
],
[
$contract:p_ci_std$CR2Q,
"5000000274",
$event:p_evt_other$1gI6O,
75631,
75631
]
] &
loop
m:lst.member (A, Mem)
define
F = [] &
C = []
do
(
Mem <=> [_, Two, _, Four _] &
C = :lst.append (C?, [[Two, Four]]) &
D = :lst.unique (C) &
if
D <> C
then
(
F = F? &
C = D
)
else
(
F = :lst.append (F?, [Mem]) &
C = D
)


)

USER CREATION FOR GRAPHTALK

1)Log in to Oracle DBA administrator as shown in Fig 1.
Use the Username: Password:
2)Go to Security -> Users in DBA Studio and right click as shown in Fig 2.
Select the Create option here.
3)Enter the User name and Password
4) Go to tab “Role” in the Create user screen. Select the Roles . Press “Create” button on the screen.
5)Log in to Graphtalk using existing user id or GRAPHTALK/ GRAPHTALK user.Open the menu “Tools->Security Manager”
6)Go to User tab and create new user. Use id should be same the one which you mentioned in DBA Studio. Press OK
7) Run the Slice manager using menu “Tools -> DBMS-> Slice Manager”
8) Follow these steps for running Slice manager for the newly created user.
Ø Select the New User id.
Ø Go to Classes Tab and Select all Packages.
Ø Select all classes in Right side.
Ø Go to Advanced tab and select “Destroy existing slices by classes and user” and
Press “Apply ” button. Press “Done".

FAQ's Batch Architecture in Graphtalk

1)Error Message “Finalization of execution 475 aborted: uncompleted slices left”
Sol:
a) The batch controller class should be persistent, with no historical management and its parent class should be $gtbatch:c_slice_ctrl
b) Check if TMP directory is present in the location specified
c) Future date transactions

2)Error Message “An Error occurred while running the command “process_slices_” The Execution 472 has been stopped.” This occurs if number of processes is less than number of users
Sol: The number of GraphTalk processes running at the time of execution should be equal to the number of users entered plus one (the master process).

3) Error Message “Batch descriptor “Batch name” already in use.”
Sol: Batch architecture implementation doesn't allow concurrent users to execute a same batch.

4) Error Message "“Cannot find the .ini file “D:\exp_xosl2_d_b.ini””"
Sol: Suppose the batch parameter “shared_ini_files” is specified with a value of a .ini file which is not there in the specified path & if the “process_number” parameter is greater than 0 then the following error is thrown

Converting amount to words in Graphtalk

Just paste the following code for the same
if Amount <=> 0 or Amount <=> 0.0 then Value = "zero" else ( Amt_string = to_str (Amount) & Parts = :str.tokenize (Amt_string, ["."]) & :lst.member (Parts, Rupee_str, 1) & format_amount (Rupee_str, Rupee) & if ?:lst.length (Parts) <=> 1 then ( Paise = "" ) else ( :lst.member (Parts, Paise_str, 2) & format_amount (Paise_str, Paise) ) & if Paise <=> "" then Value = "Rupees " ++ Rupee ++ " only" else Value = "Rupees " ++ Rupee ++ " and " ++ Paise ++ " paise only" ) ; format_amount (Amount, Res) :- Length = :str.length (Amount) & Length > 2 & ! & Group_list = [" crore " = 7, " lakh " = 5, " thousand " = 3, " hundred " = 2] & loop m:prop.get (Group_list, Prop, Num_zero) define Res = "" do ( if Res? <=> "" & Length > Num_zero then ( Part1 = :str.sub (Amount, 1, ?(Length - Num_zero)) & Len1 = :str.length (Part1) & Part2 = :str.sub (Amount, ?(Len1 + 1), ?(Length - Len1)) & format_amount (Part1, Str1) & format_amount (Part2, Str2) & if ?:str.strip (Str1, " ", [mid]) <=> "" then Res = Str2 else Res = Str1 ++ Prop ++ Str2 ) else Res = Res? ) ; format_amount (Amount, Res) :- Num = to_integer (Amount) & case Num <=> 0 then Res = "" else_if Num < 20 then :$claimref:methods.get_enum_single ($techncl:general, ones_type, Res, ?to_str (Num), _) otherwise ( :$claimref:methods.get_enum_single ($techncl:general, tens_type, Str1, ?:str.sub (Amount, 1, 1), _) & format_amount (?:str.sub (Amount, 2, 1), Str2) & Res = Str1 ++ " " ++ Str2 )

Do remember this is applicable for INR and changed are needed for other currencies

Modulo for Higher Values in Graphtalk

GraphTalk XO system is not able to handle the case wherein modulo for the higher values of variables of data type-Integers & Real is required. The inbuilt mod function fails to produce the required result and abruptly fails
The below code solves the problem

get_remainder (Para, Res) :-
[Amt, Step_amt] = :prop.getl (Para, [amt, step_amt]) &
get_rem (Amt, Step_amt, Res)
;

get_rem (Amt, Step_amt, Res) :-
if
Amt >= Step_amt
then
Rem = Amt - Step_amt
else
Rem = Amt &
If
Rem >= Step_amt
then
get_rem (Rem, Step_amt, Res)
else
Res = Rem;

Tuesday, March 11, 2008

Tips on setting up Graphtalk with Oracle 10g

Ensure the following are present:
Check for the following permissions for import as follows:
a) Go to "Control Panel" -> "Admin Tools" -> "Local Security Policy."
Within "Local Policies", go to user "Right Assignment."
Add the user to "Logon as a Batch Job."
b)In the Enterprise Manager Console, add the user who will run the Export/ImportDataPump job as an Administrator who can login to Enterprise Manager to performmanagement tasks like set Blackouts, email notification schedules.
c)- login as user SYSTEM (or user SYS) to the 'Enterprise Manager 10g Database Control'- At the top right, click on the link 'Setup'- On the page 'Administrators', click on the button 'Create'- On the page 'Create Administrator: Properties', add the user who will run the Export/Import DataPump job- Click on the button: 'Finish'- On the page 'Create Administrator: Review', click on the button: 'Finish'- On the page 'Administrators', confirm that the user has been added.- At the top right, click on the link 'Logout'. Now login as the user who will run the Export/Import DataPump job (Graphtalk),and re-create the DataPump job.

Thursday, March 6, 2008

Double side printing in Graphtalk

The present print_word_management doesn’t provide an option to set the duplex printing function. This can be handled by the usage of logical printers.
Once logical printeres are installed the following code needs to be written in graphtalk to call the double side logical printer
Word = :ole.create_object("Word.Application") & if
t:ole.check_connection(Word)
then
(
x:Word.activeprinter = "Doubleside[V1] "
) &
x:Word.release

Depending on the need the above piece of code may be used before the call of print_word_management

[V1]Would be the Printer name depending on choice of duplex or single

Wednesday, March 5, 2008

How to create an XML file from the Graphtalk instances

Just copy paste the below code by providing appropriate field names and class name!!!

:dom.create_document (Doc) &Employees = x:Doc.create_element ("employees") &create_employees (Doc, Employees) &x:Doc.append_child (Employees) &x:Doc.save ("c:\employees.xml") &x:Doc.release;create_employees (Doc, Employees) :- count (1, 2,Obj= m:obj.find ($contract:p_ci_prot, nil)) & create_employee_element (Doc, Obj, EmployeeNode) & x:Employees.append_child (EmployeeNode) & fail;create_employees (_, _) ;
create_employee_element (Doc, Obj, EmployeeNode) :- IdStr = get:Obj.nmbr & get_elt_data (nmbr, Obj, FamilyStr, CountFamily, SepFamily) & get_elt_data (situation, Obj, FirstNStr, CountFirstN, SepFirstN) & EmployeeNode = x:Doc.create_element ("employee") & x:EmployeeNode.set_attribute ("id", IdStr) & create_text_elt (Doc, "nmbr", FamilyStr, CountFamily, SepFamily, Fam) & create_text_elt (Doc, "situation", FirstNStr, CountFirstN, SepFirstN, FirstN) & x:EmployeeNode.append_child (Fam) & x:EmployeeNode.append_child (FirstN);
create_text_elt (Doc, Tag, Content, Count, Sep, Elt) :- Elt = x:Doc.create_element (Tag) & set_attribute_def (Elt, "count", "1", Count) & set_attribute_def (Elt, "separator", " ", Sep) & TextNode = x:Doc.create_text_node (Content) & x:Elt.append_child (TextNode);
set_attribute_def (_, _, Default, Default) :- !;set_attribute_def (Elt, Attr, _, Val) :- x:Elt.set_attribute (Attr, Val);
get_elt_data (Field, Obj, Str, Count, Sep) :- DbData = get:Obj.Field & elt_data (DbData, Str, Count, Sep);
elt_data ([List, Sep], Str, Count, Sep) :- ! & CountI = :lst.length (List) & Count = to_str (CountI) & :lst.make_str (List, Str, Sep);elt_data (Str, Str, "1", _) ;

Sunday, February 24, 2008

Graphtalk-Introduction

Graphtalk is an object oriented technology developed for life insurance applications. One of its prevelant users is Cardif.

Many companies like Infosys, L&T etc use graphtalk technology.