Monday, August 04, 2008

I Am Very Happy ...

My colleague came in this morning and he thanked me for all those scripts that I wrote to assist him in the BMC Remedy data migration. He was telling me that he carried out the migration over the weekend and it's been successful cut over to the newer version.

The latest script that I wrote was to modify field definitions (CHAR-SET/SCHEMA/FIELDS/FLD-ID/DTYPES/DATA) and add an additional column in the DATA field. The DATA field has to be modified on certain condition and he claimed that it was almost impossible to do it in Excel. Basically you need to change the content of the field from EARS<numbers> to INC0<numbers> and it has to be applied to the last occurrence of the field. It is not too difficult to do it in Tcl and below is the code snippet.

  set field1 [lindex $line 0]
  switch $field1 {
    puts $fpw $line
    puts $fpw "$line \"Worklog Type\""
   FLD-ID {
    puts $fpw "$line 88888888"
    puts $fpw "$line CHAR"
   DATA {
    # change the last EARS to INC0
    # append quoted string "8000"
    set p1 [string last EARS $line]
    if { $p1 >= 0 } {
     set line [format {%s%s%s} \
      [string range $line 0 [expr {$p1-1}]] \
      INC0 \
      [string range $line [expr {$p1+4}] end] \
    puts $fpw "$line \"8000\""
   * {
    puts $fpw $line

BTW, half of my code is meant for the GUI.

Another thing that made me happy is that I realised someone started to read my blog.

Labels: ,


Post a Comment

<< Home