<?xml version="1.0" encoding="UTF-16"?>
<snippets>
    <category filters="*" icon="" id="category_1141861633004" initial_state="0" label="Demo Snippets" largeicon="">
        <description/>
        <item category="category_1141861633004" class="" editorclass="" icon="" id="item_1142255404717" label="4. Call Inventory Service" largeicon="">
            <description><![CDATA[	function CheckInventory()]]></description>
            <content><![CDATA[	function Inventory()

		calcInv1_ServiceBindingLib.calcInv1.calcInventory(srv_rowClick_SNIPPET_product, srv_ProductSearch_srchString);

		text1 HtmlInputText;

		text1 = viewRoot.findComponent("form1:text1");

		text1.setStyle("font-weight: bold; color:${color}");

	end]]></content>
            <variable default="red" id="name_1" name="color">
                <description/>
            </variable>
        </item>
        <item category="category_1141861633004" class="" editorclass="" icon="" id="item_1141996185351" label="Table Search Service" largeicon="">
            <description><![CDATA[	function productSearch(srchString string, products productSrchRec[]) returns(string)]]></description>
            <content><![CDATA[	function ProductSearch(srchString string, ${tableArrayName} ${tableSQLRecord}[]) returns(string)
		srchStringSQL string = "%"+srchString+"%";	//Add SQL wildcard tokens
		get ${tableArrayName};								//return all products (modify explict SQL)
		if (size(${tableArrayName}) < 1)						//If no rows returned, alert user
			return("Sorry... no ${tableArrayName} match your search criteria: " + srchString);
		else
			return(""+size(${tableArrayName})+" products found, that match your search criteria");	
		end
	end]]></content>
            <variable default="productSrchRec" id="name_2" name="tableSQLRecord">
                <description><![CDATA[The record type definition]]></description>
            </variable>
            <variable default="products" id="name_1" name="tableArrayName">
                <description><![CDATA[The name of the variable for the record]]></description>
            </variable>
        </item>
        <item category="category_1141861633004" class="" editorclass="" icon="" id="item_1141994646839" label="3. Inventory Service" largeicon="">
            <description><![CDATA[	function calcInventory (product productSrchRec, msg string)]]></description>
            <content><![CDATA[	function calcInventory (product productSrchRec, msg string)
		productInv productInvRec;
		product.prodqtyoh = product.prodqtyoh -1;
		move product to productInv byName;		
		if (product.prodqtyoh < product.reorderamt)
			call reOrder productInv;
			msg = "*** Need to reorder ***";
		end
	end
//The following imports are needed for EGL product record and reOrder program		
import libraries.*;		//Copy above the Service statement
import programs.*;]]></content>
        </item>
        <item category="category_1141861633004" class="" editorclass="" icon="" id="item_1141985670355" label="arrayLookUp" largeicon="">
            <description><![CDATA[Used to cross-reference a value within an array]]></description>
            <content><![CDATA[		get ${arrayName};

		if(${searchRec}.${searchField} in ${arrayName}.${searchField})

			${resultField} = ${arrayName}[arrayIndex].${arrayField};

		end

		

		//${resultField}  ${resultFieldType}]]></content>
            <variable default="supplierSel" id="name_4" name="resultField">
                <description/>
            </variable>
            <variable default="string;" id="name_6" name="resultFieldType">
                <description/>
            </variable>
            <variable default="product" id="name_2" name="searchRec">
                <description/>
            </variable>
            <variable default="suppnm" id="name_5" name="arrayField">
                <description/>
            </variable>
            <variable default="supplier" id="name_1" name="arrayName">
                <description/>
            </variable>
            <variable default="suppid" id="name_3" name="searchField">
                <description/>
            </variable>
        </item>
        <item category="category_1141861633004" class="" editorclass="" icon="" id="item_1141917081203" label="2. callServicesFromEGL" largeicon="">
            <description><![CDATA[		j2eeLib.setSessionAttr("cart", srv_addToShoppingCart_ShopCartID);]]></description>
            <content><![CDATA[/* This next function calls an EGL service - passing it a record and ShopCart ID
	This Snippet contains parameters that provide code reuse  */

	Function AddToCart()
		//srvLib.shopCartSrv.addToCart(${record}, ${shopCart});
	End

	Function CheckOut()
		j2eeLib.setSessionAttr("cart", ${shopCart});	//Store cartID in "Session"
		forward ${shopCart} to "shopcartpage";			//Open shopping cart page
	end]]></content>
            <variable default="srv_rowClick_SNIPPET_ShopCartID" id="name_2" name="shopCart">
                <description/>
            </variable>
            <variable default="srv_rowClick_SNIPPET_product" id="name_1" name="record">
                <description/>
            </variable>
        </item>
        <item category="category_1141861633004" class="" editorclass="" icon="" id="item_1141861645042" label="1. getClickedRow" largeicon="">
            <description><![CDATA[		table1 HtmlDataTable;]]></description>
            <content><![CDATA[table1 HtmlDataTable;										//Declare a variable to the table
		table1 = viewRoot.findComponent("form1:table1");	//Initialize the variable
		row int = table1.getRowIndex()+1;					//Return the clicked row index
		srv_rowClick_SNIPPET_product.prodid = srv_productSearch_products[row].prodid;	//Get the associated product]]></content>
        </item>
    </category>
</snippets>
