Jump to: navigation, search

Difference between revisions of "EDT:Tutorial: RUI With DataBase Lesson 7 Code"

(New page: Access a database with EGL Rich UI > [../../../../topic/com.ibm.egl.richui.sql.tutorial.doc/topics/egl_richui_sql_resources.html Re...)
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
  
 
+
[[EDT:Tutorial: Access a database with EGL Rich UI|Access a database with EGL Rich UI]] > [[EDT:Tutorial: RUI With Database Resources|Resources]]
 
+
 
+
[[EDT:Tutorial: Access a database with EGL Rich UI|Access a database with EGL Rich UI]] > [../../../../topic/com.ibm.egl.richui.sql.tutorial.doc/topics/egl_richui_sql_resources.html Resources]
+
  
 
= Finished code for PaymentLib.egl after lesson 7 =
 
= Finished code for PaymentLib.egl after lesson 7 =
  
The following code is the text of the <tt>PaymentLib.egl</tt> file
+
The following code is the text of the '''PaymentLib.egl''' file
 
after lesson 7.
 
after lesson 7.
  
Line 50: Line 47:
 
''' Related tasks '''<br />
 
''' Related tasks '''<br />
  
[[EDT:Tutorial: Access a database with EGL Rich UI Lesson 7|Lesson 7:  Create a library of reusable functions]]
+
[[EDT:Tutorial: RUI With DataBase Lesson 7|Lesson 7:  Create a library of reusable functions]]
  
  
 
[[Category:EDT]]
 
[[Category:EDT]]

Latest revision as of 09:10, 1 December 2011

Access a database with EGL Rich UI > Resources

Finished code for PaymentLib.egl after lesson 7

The following code is the text of the PaymentLib.egl file after lesson 7.

  package libraries;
  
  library PaymentLib
  
      categories string[] =[
  
                      "Rent",          // 1
                      "Food",          // 2
                      "Entertainment", // 3
                      "Automotive",    // 4
                      "Utilities",     // 5
                      "Clothes",       // 6
                      "Other"          // 7
              ];
  
      function getCategoryDesc(cat int in) returns(string)
          if(cat != 0)       // the integer is not 0
              return(categories[cat]);
          else
              return("");
          end
      end
  
      function getCategoryNum(desc string in) returns(int)
          for(i int from 1 to categories.getSize())
              if(categories[i] == desc)
                  return(i);
              end
          end
          return(0);	// no match
      end
  
      function stringAsBoolean(value string in) returns(boolean)
          return(value == "true");
      end
  
  end

Related tasks

Lesson 7: Create a library of reusable functions