About Me

My photo
Dhaka, Dhaka, Bangladesh
✔4x Salesforce Certified ✔Web Application Developer ✔Database Developer with DWH/ETL/BI • Successful solution engineer and developer with 16+ years of experience multiple technology and in different countries. Proficient in implementing business requirements into the technical solution. Experience handling all phases of the project lifecycle from discovery through to deployment. Worked as technical lead for a team of junior developers to make sure code stayed in line with requirements and standard best practices. Skilled at integrating disparate systems with Salesforce.Experience implementing Salesforce Community Cloud at two previous companies.

Saturday, May 21, 2011

Reference Guide to Supply Chain Management (SCM) Features and Functions

Reference Guide to Supply Chain Management (SCM) Features and Functions

Reference Guide to Supply Chain Management (SCM) Features and Functions

Anne Le Bris and Melissa Vaes, with contributions from TEC analyst data - 5/4/2010 1:24:00 PM

This SCM reference guide provides insight into the supply chain management (SCM) features and functions currently accessible on today’s market. This guide will help you understand which features are essential for your organization and which are not.

You can also download a comprehensive guide in Excel format, with all of the nearly 2,600 SCM functions and features, at TEC’s Supply Chain Management (SCM) RFP Template page.

Before we get started, here is a short definition of the role of SCM software in supply chain activities:

What Is SCM Software?

SCM software manages product flows from supplier, to manufacturer, to customer. In brief, it manages supply and demand for an organization. According to APICS, SCM software refers to

the design, planning, execution, control, and monitoring of supply chain activities with the objective of creating net value, building a competitive infrastructure, leveraging worldwide logistics, synchronizing supply with demand, and measuring performance globally.

SCM systems integrate all features of procurement processes, warehouse management system (WMS) features and functions, transportation, and logistics, as well as other product planning modules.

To learn more about the distinction between advance planning and scheduling (APS), SCM, and enterprise resource planning (ERP), read TEC’s article Comparative Analysis: Are You Still Confused About APS, SCM, and ERP?

About This SCM Guide

Our SCM request for information (SCM RFI) template is composed of almost 2,600 criteria; consequently, we’ll focus here on the “big picture” features only.

We’ve brought SCM features together by broad category:

  1. Warehouse management system (WMS)
  2. Transportation management system (TMS)
  3. International trade logistics (ITL)
  4. Supplier relationship management (SRM)
  5. Demand management
  6. Supply chain analytics
  7. Order management
  8. Service parts planning
  9. Product technology

These categories correspond to a high-level functional breakdown of software features. In this reference guide, we give a short explanation of how each category impacts your supply chain management processes.

If you would like more information about full listings of enterprise software functions and features (SCM, ERP, and other enterprise software categories), please see TEC’s RFP Templates.


Supply Chain Management (SCM) Software Functions and Features

SCM functions and features, submodule #1: warehouse management system (WMS)

Functionality
This category includes the general warehouse management functionalities such as warehouse configuration, bin location and product setup, inventory control, license plate tracking, quality control, picking, packing and shipping, etc.

Adaptability
The adaptability module in SCM software covers business processes, decision support, and reporting.

Warehouse management system (WMS) technology configuration
The technology configuration addresses WMS-specific functionality such as radio-frequency identification (RFID), security, and internationalization supported by each vendor. It also touches on programming and other technologies used in the development of the WMS application.


SCM functions and features, submodule #2: transportation management system (TMS)

System definition and implementation
The TMS should include tools and applications to enable to create profiles for all your contracts, associated carriers, and trade lanes for inter-modal and multi-leg moves. This should support regional as well as international transportation movements. The key to the successful operation of the TMS is a robust foundation created during the system implementation.

Transportation management operation functionality
Transportation management operation functionality allows distributors to align their transportation operations with their supply chain strategies and overall business objectives. This includes areas that take into consideration the entire shipment life cycle, from planning, network optimization, and execution, to shipment tracking and analysis.


SCM functions and features, submodule #3: international trade logistics (ITL)

Collaboration
True collaboration across a global and disparate set of entities and information systems requires a neutral and secure environment. This type of environment enables all players to engage in an electronic dialogue to collaborate in acquiring, transferring, transporting, and settling with regional and international trading partners. In addition, the data model should take into account the different roles of all participants and manage these through a set of rule-based processes. As such, the system implementation should include clear definitions in terms of buy-sell relationships, financial terms, and service level agreements, as well as related contact details and user profiles for suppliers, customers, and related service providers.

Content
The system should support all the data and information required in order to establish a true total cost of goods sold at the time of the initial buy-sell transaction. The SCM software should also enable users to track incremental costs as the shipment is processed from point of origin to final point of receipt. All costs and activities should be available at the transaction initiation point and can be classified by the primary components, which are product costs, compliance costs, and logistics costs.

Commerce
Starting with the initial request for goods—whether this is an RFI, a request for quotation (RFQ), or a formal purchase order, all information that is exchanged during the shipment life cycle should be facilitated by the international trade logistics (ITL) system. This requires a synchronized system and process, where the product and shipment requirements are integrated into an automated order fulfillment environment. The product item master and associated tables will determine the cost of the product as well as the relationship between the product and any duties or tariffs that are applicable. Tables related to customs duties and tariffs as well as associated rates of exchange and transportation costs should be available as part of the system functions. This will enable the user to obtain an estimated total cost of goods sold as well as a final cost of goods sold, to highlight any variances or discrepancies. This implies a data model that includes an understanding of all the data exchanged and processed at the product and item level, between order management systems, as well as the data exchanged with warehouse management and transportation systems.


SCM functions and features, submodule #4: supplier relationship management (SRM)

Design
Best practice dictates that strategic suppliers be involved in the new product process from the very beginning—i.e., the concept, requirements, and design definition phase. Supplier relationship management (SRM) suites support this with functionality for requirements collaboration tools, component selection tools, and bills of materials (BOMs) grading.

Sourcing
Many consider sourcing to be the heart of SRM and commodity management to be the heart of sourcing. Advanced sourcing suites are rich in analysis and decision support technology to absorb huge amounts of data quickly and make intelligent sourcing decisions. They also lay the foundation of execution through RFI, RFQ, and RFP processes, and manage performance against contracts. Risk management is an area which spans the full life cycle, in particular association with the sourcing function.

Procurement
Procurement is generally divided into material requirements planning (MRP)-driven procurement (sometimes referred to as direct materials procurement) and requisition-driven procurement (sometimes referred to as indirect or maintenance, repair, and operations [MRO] procurement), although some long-lead-time, first-run direct materials are ordered via requisitions. This division reflects substantial differences in the two methods of procurement. Management of catalogs supports requisition-driven procurement and the sourcing processes that precede MRP-driven procurement.

Fulfillment
The bulk of fulfillment functionality is traditionally performed by ERP and related systems such as order management, warehouse management, and distribution management systems. As companies virtualize and suppliers become increasingly involved in the fulfillment process, some functionality is appropriate within SRM. SRM systems should support a range of modern inbound inventory management practices, such as kanban and vendor-managed inventory (VMI) and provide visibility into the inbound pipeline. Returns management becomes important in SRM for situations where components are being returned to and repaired or replaced by suppliers.

Manufacturing
As with fulfillment, the bulk of manufacturing functionality is traditionally performed by ERP systems. However, the important supplier-facing processes of quality and engineer change order (ECO) management may be done outside the ERP system as part of an SRM suite.

Settlement
The primary SRM-related function for settlements is in reconciliation between the original order, actual received goods, and the invoice. Advanced settlement processes may also be supported, such as evaluated receipts or electronic invoice presentation and payment.

Utilities
There are several areas that span across the lifecycle categories. Specifically, you need project management utilities during design, sourcing, and manufacturing. The same is true for managing BOMs and managing cost.

Infrastructure
SRM is by nature an integrative function and requires the infrastructure to support that integration, as well as to manage the massive volume of related content, alerts, and data.


SCM functions and features, submodule #5: demand management

Promotion planning
Promotion management systems allow your organization to plan promotions with your trading partners, including simulating, executing, and evaluating the promotion performance. Some performance planning issues to be aware include the following:

  • Promotion plans are frequently not integrated into the demand stream.
  • Promotions are launched without the requisite tracking of real-time events to monitor and modify the promotions in action, during the promotion cycle.

Pricing and profit optimization
The pricing and profit module manages profitable and sellable prices for products by dimensions such as markets, demographics, and channel partners. The module also enables future evaluation by maintaining pricing logic and results. The challenge in pricing is that the source and adjustments to price come from various organizations within the enterprise and the channel partners, which impacts actual pricing and profitability. Thus, the ability to track and report history is equally important for managing pricing activities.

Forecasting
Reliable forecasts are based not only on algorithms that are appropriate to the business setting, but also on an inclusive, highly integrative process that gathers all data that can impact the ultimate demand placed upon the supply chain. Data granularity is critical to ensuring that the right product at the item level is produced or distributed. Superior forecast processes require the evaluation of historical data as well as the current demand activity, and the ability to adjust forecasts on the most current data and assumptions.

Merchandise planning
Merchandise planning analyzes demand at the item level. It allows organizations like merchants (retailers) to understand demand based on issues ranging from demographics, store locations, shelves, and support, to purchasing as well as the positioning of merchandise in the retail channel.

Life cycle planning
Life cycle planning is becoming a more popular capability. Demand characteristics change over the life of a product and require close attention to demand patterns to ensure that markets are not starved during ramp-up, or supplied with excess in later stages. In addition, firms are frequently left with excess inventory thanks to ECOs or other product changes, as well as at end-of-life, due to poor planning and visibility into demand cycles and communication of product phase-outs. Life cycle planning provides the ability to view sell-in and sell-through point of sale (POS) data and will recommend alternate curves based on early actual sales information.

Consensus planning
Consensus planning is a method to create a "one number" forecast for the enterprise. Within complex organizational structures, many professionals are responsible for planning in different areas, such as product marketing for product and product families; sales for territory sales plans; channel and alliance management for channel forecasts; finance for revenue and corporate strategic plans; and manufacturing for shipment or off-the-dock plans. The wide range of professionals involved often creates confusion, poor coordination, and missed business opportunities when sales are missed or excess inventories mount. Ultimately, a process must produce a forecast—one number—upon which the supply chain will act.

Collaborative planning
Collaboration among trading partners has become standard practice in many industries as more supply chain activities are being outsourced. Within the demand management module, collaborative forecasting must comply with process and data standards that have been validated by the Voluntary Interindustry Commerce Solutions (VICS) Council, RosettaNet, and other industry bodies that have modeled these processes for their industries. In addition, a collaborative software system must allow the ability for joint sharing and modeling of demand supply gaps between trading partners. It must allow trading partners to view, drive alternative solutions and simulations, and resolve issues around price and unit availability, which include flexibility and target replenishment levels (re-order points).

Sales and operation planning (S&OP)
S&OP is a process that employs enabling technology to balance demand and supply to create a feasible forecast that meets an enterprise's global organizational needs. Cross-functional organizations from marketing to manufacturing require visibility, simulation, and consensus building for meeting revenue, cost, and delivery needs. The ability to reallocate and reprioritize based on customer, profit, and other factors are important elements of S&OP today. It is important to determine whether the vendor supports the S&OP process with information from multiple systems. S&OP processes also ask questions around investment to improve responsiveness, customer service, reduce risk, and increase market share. Integration is important because the data to answer these questions may reside in other modules such as APS or inventory planning.

Vendor-managed inventory (VMI) replenishment
VMI replenishment allows the co-management of inventory by both customers and suppliers. Best practices allow for joint creation and analysis of the current level of inventory to support demand and keep cost down. In addition, VMI dynamically detects when inventory levels fall bellow required (agreed-to) levels and place a refill (replenishment) order.

Event planning
Event planning for various marketing events has become more complex as more firms use a rich set of trading partners, which include media, channel partners, and retailers. Product launches, special media and advertising, promotional events, or new store openings need finely tuned planning to be successful. Today, systems must move from PowerPoint-level tools to strong profit analytics for ensuring market success and return on investment (ROI).

Metrics and reporting
Metrics and reporting capabilities today must be forward-looking to report (but more importantly, prevent) negative business performance. Beyond excellent modeling and simulation capabilities, metrics systems must be real-time and predictive. They must not only record real-time events and their impacts, but also use techniques such as pattern recognition to determine processes out of tolerance and provide early detection. Preventing late orders is better than reporting late orders, naturally.

Demand management systems architecture
Demand management tools have unique and high levels of integration requirements. These requirements should be factored into your evaluation of SCM functions and features if your organization places a high priority on demand management functionality.


SCM functions and features, submodule #6: supply chain analytics

Supply chain optimization
Supply chain optimization modules allow you to design the best-fit (optimal) supply chain by time, cost, and other factors, in order to create responsive and lean supply chains. Each module has a unique specialty such as logistics or inventory. In addition, the optimized network blends and trades off all these factors.

Supply chain event management
Supply chain event management (SCEM) or supply chain network systems are a new class of solutions designed to monitor, notify, analyze, measure, and control business process and execution types of activities. These systems take advantage of new architectural principles brought about by several forces: high-availability, publish-and-subscribe architectures; tools like Java; the maturity of artificial intelligence (AI) rule-based programming capabilities; emerging agent technologies; and Web architectures and standards such as simple object access protocol (SOAP) and extensible markup language (XML). These solutions allow open, real-time views into global information, as well as the ability to pinpoint and drill into key information, sensing deviations in business plans versus execution expectations (unplanned events).

Production and supply planning
Today's supply chain planning systems have significant advantages over the manufacturing resource planning (MRP II) systems of the past. These systems incorporate up-to-date algorithms and philosophies on how supply chains work. In addition, they have a technology advantage over MRP II, in that they are memory-resident, which allows the solutions to solve simulation issues extremely quickly, with very large arrays (models). These large models solve simultaneous, multi-level, and multi-node problems that MRP II systems cannot.


SCM functions and features, submodule #7: order management

Order promising
The order promising submodule includes criteria for available-to-promise (ATP) and configuration management across multiple databases, integration of configuration management with multiple unique BOMs, and integration with demand and replenishment orders.

Inventory management and visibility
Many organizations want to provide real-time promising, so inventory visibility from multiple sources is critical.

Sourcing
A primary attribute of a distributed order fulfillment system is the ability to perform multi-stage sourcing and assembly. This requires a very open architecture to integrate seamlessly with various systems and supply chain nodes, in a real-time fashion.

Execution visibility
Once an order has been promised, keeping track while the order is built and shipped has become a critical function in the supply chain.

Inbound and assembly coordination or multi-site staging
Many orders are sourced and built by a network of partners. Frequently, notification of cancellations does not occur. Keeping these orders synchronized is critical toward meeting schedules as well as avoiding over-building or building ahead of demand.

Shipping and outbound management
Once an order has been created and built, it must be shipped. Notification of advance shipments to customers is key to seamless transportation, as well as tracing, tracking, and receiving the orders.

Order management-specific technology
A distributed architecture is key to a successful order management system, whether supply chain nodes are internal or external to the enterprise.


SCM functions and features, submodule #8: service parts planning

Planning
Service parts planning deals with the creation and replenishment of a supply network for service operations. This can include original equipment manufacturers (OEMs) and service partners, as well as service logistics providers.

Service delivery and execution
The service delivery and execution submodule includes functionality for integration with call center systems (for dispatching requirements), service response prioritization and optimization, allocation of scarce parts, and dispatch.

Workforce optimization
Workforce optimization is used for determining the right skill mix and location of personnel to support service demands. This can include on-site, co-managed personnel at the customer site.

Logistics transportation and reverse logistics
Transportation planning and execution has a significant role to play in the service supply chain. As in traditional models, there is always a trade-off in time and cost between fixed assets and delivery responsiveness in serving customers. Dynamic repair needs such as emergency breakdowns in remote settings can exacerbate delivery problems. In addition, reverse logistics issues, such as pickup of parts for delivery to third-party locations for repair, are addressed in this submodule.

Analytics and reporting
The service planning system is a wealth of information for many organizations which are accountable for product planning and design, asset and capital management, and general customer relationship management. Therefore analytics and reporting features are not just designed to enable functional excellence, but also to feed these other key areas of the value chain.


SCM functions and features, submodule #9: product technology

Architecture
Architecture refers to the framework for organizing the planning and implementation of data resources. It also refers to the way the system is designed and the manner in which all components are connected to one another.

User interface
User interface refers to the manner in which people access and interact with the software. The user interface should facilitate the user's easy operation of the software.

Platforms
The platform refers to the framework, both the hardware (e.g., type of processor) and the operating system that allows a computer or set of computers to function.

Application tools
Application tools are the components that provide the ability for an application or program to work.

Reporting
Functionality for reporting refers to technical options for generating and delivering reports.

SaaS and hosting options
This category refers to features for software-as-a-service (SaaS) or hosted solutions


Final Thoughts
A comprehensive SCM RFP will also include other general considerations, including reseller and value-added reseller (VAR) channels, along with vendor viability considerations.

We hope you’ve found this reference guide helpful. For more information about SCM features and functions, as well as functionality for other classes of enterprise software, please visit TEC’s RFP Templates page.

For more information and to start your own custom solution evaluation of SCM software, including the ability to assess and prioritize the SCM functions and features that are important to your organization, please visit TEC’s SCM Software Evaluation Center.


Wednesday, May 11, 2011

RetrieveTreeHierarchy / SQL server / SQL/T-SQL

General way to handle trees. Fails when the sequence varchar length is exceeded - in this case 100 levels.
Author Nigel Rivett
-- create test data
create table #z (id int, name varchar(20), Parent int null)
insert #z select   1,  'foo', null
insert #z select     2,  'foo2',   null
insert #z select     3,  'foo2a',      2
insert #z select    11,  'foo2aa',     3
insert #z select    12,  'foo2aaa',   11
insert #z select    13,  'foo2ab',     3
insert #z select    14,  'foo2ac',     3
insert #z select     4,  'foo2b',      2
insert #z select     5,  'foo3',   null
insert #z select     6,  'foo3b',      5
insert #z select     7,  'foo3ba',     6
insert #z select     8,  'foo4',   null
insert #z select     9,  'fooa',       1
insert #z select    10,  'foo2ba',     4

-- Get the hierarchy
create table #tree (id int, sequence varchar(1000), levelNo int)
-- insert top level (to get sub tree just insert relevent id here)
insert #tree select id, right(space(10) + convert(varchar(10),id),10), 1 from #z where Parent is null
declare @i int
select @i = 0
-- keep going until no more rows added
while @@rowcount > 0
begin
     select @i = @i + 1
     insert #tree
     -- Get all children of previous level
     select #z.id, sequence + right(space(10) + convert(varchar(10),#z.id),10), @i + 1
     from #z, #tree 
     where #tree.levelNo = @i
     and #z.Parent = #tree.id
end

-- output with hierarchy formatted
select space((levelNo-1)*4) + #z.name 
from #tree, #z 
where #tree.id = #z.id
order by sequence

drop table #tree
drop table #z

/*  OUTPUT
foo
    fooa
foo2
    foo2a
        foo2aa
            foo2aaa
        foo2ab
        foo2ac
    foo2b
        foo2ba
foo3
    foo3b
        foo3ba
foo4
*/

Using a Tree View/Asp.net/C#/IronSpeed


Using a Tree View

A Tree View can be used in an Iron Speed Designer application to display hierarchical data from the database, and when the user selects one of the nodes, the relevant information can be displayed to the user on the right.

In the example below, a tree view is used to display a list of products organized hierarchically within each category.  The user can expand any Category and then select a Product.  The details of the selected Product will be displayed on the right.



Iron Speed Designer allows a tree view control to be easily integrated into applications, and populate it with data from the database.  The Selected Node Changed event handler is implemented to display the selected product to the right of the tree view.
In this example, an ASP:TreeView control is added to the spreadsheet grid within the Design Mode for a page. The tree control is populated dynamically when a user expands or collapses a particular section of the tree.  A Populate function is called to fill the sub-tree whenever the user expands a section of the tree.  The Populate function will populate the tree with either Categories or with the list of Products within a Category.  An event handler is implemented to handle the selection of a specific node to display information about the product on the right.
This example extends a Show Product record page built using Iron Speed Designer.  The Southwind database included with Iron Speed Designer is used for this application.  Normally, the Show Product record page displays the Product based on the URL parameter. This page will be extended to display the Product selected in the Tree View.  The initial display of the product specified by the URL will continue to work as-is.
The first few steps insert the tree view into the page layout, and the following steps implement the callback functions to populate the tree, and handle the selection of a node.

Layout Changes

Step 1Create space for a tree view:  Go to the Design mode on the Show Product page. Zoom out to the ShowProduct.aspx.



 


Step 2: Move the ProductsRecordControl two columns to the right to allocate space on the page for the Tree View control in the Quick Layout. The second column will be used to add a HTML space character  (   )  to separate the tree view from the product record control.



 
Step 3. (Optional) Delete all the controls in the Cell with the ProductsTabContainer and replace it with a HTML space  (   ) in the cell editor.
 

Step 4: Insert Tree View: Select the top-left cell A1. Copy and paste the following asp:TreeView Control into the Cell Editor.


Code:


TreeView Properties: The inserted tree view specifies a number properties as described below:


Property
Description
ID
Id of the tree view control (tvCategories).
runat
Indicates the ability to access this control in the code-behind.
Font-Names
Font used to display entries in the tree view.
ForeColor
The foreground text color.
ExpandDepth
The initial expansion shown to the user.
ExpandImageUrl
The image shown to indicate a node can be expanded.
CollapseImageUrl
The image shown to indicate a node can be collapsed.
OnTreeNodePopulate
The code-behind function to be called when a user clicks the node for expansion.  This function will populate the products within a category.
OnSelectedNodeChanged
The code-behind function to be called when a user selects a leaf node.  This function updates the product record on the right.
SelectedNodeStyle-BackColor
The background color to use to display a selected node.
SelectedNodeStyle-ForeColor
The foreground color to use to display a selected node.
Nodes
A substructure that specifies the initial list of nodes in the tree view.  Only the top-level node is included at this point, and the sub-nodes will be added by NodePopulate function when it is called when the user expands a node.
LevelStyles
The styles for each of the levels. There will be three levels, so the styles for each of the three levels are defined.  Currently they are the same styles, but could be different.

Step 5: Align Tree View to the top of the cell:  By default, all content in the cell is shown center-aligned vertically.  To display the tree view at the top, right-click and select Align, Top.




Code Changes

The following steps populate the tree view nodes, and handle the selection of a product and display the updated record control on the right.
Step 6: Implement Node_Populate:  The Node_Populate method is called to populate any of the nodes in the tree control.  Node_Populate will be called either for the second-level (Category) or the third-level (Products within a Category).  Based on the level, either the FillCategories or the FillProductsForCategories is called to populate the tree view appropriately.
The name of the populate method (Node_Populate) is specified on the OnTreeNodePopulate property set on the Tree View control on the layout changes.
This code is inserted into the Section 1 of the code-behind file for the page (not the Controls code-behind file).  Click the ShowProducts.aspx.vb tab, and expand the region “Section 1”.


Copy and paste the code below:
[C#]
Code:
public void Node_Populate(object sender, System.Web.UI.WebControls.TreeNodeEventArgs e) 
{ 
if (e.Node.ChildNodes.Count == 0) { 
switch (e.Node.Depth) { 
case 0: 
// If the parent is the top-level node, then fill with Categories 
FillCategories(e.Node); 
break; // TODO: might not be correct. Was : Exit Select 

case 1: 
// If the parent is a category (depth=1), then fill with Products for the selected Catetory 
FillProductsForCategories(e.Node); 
break; // TODO: might not be correct. Was : Exit Select 

} 
} 
} 

private void FillCategories(TreeNode parent) 
{ 
// Get all records - whereClause is Nothing 
foreach (CategoriesRecord rec in CategoriesTable.GetRecords(null)) { 
// Make sure to populate the Text as the Name, and the Value as the ID so we can 
// use it later when reading the Products for the selected Category ID. 
TreeNode node = new TreeNode(rec.CategoryName, rec.CategoryID.ToString()); 
// Populate when needed - this will ensure that only the first level is populated 
// when tree is first displayed. 
node.PopulateOnDemand = true; 
// Expand when selected. 
node.SelectAction = TreeNodeSelectAction.Expand; 

parent.ChildNodes.Add(node); 
} 
} 

private void FillProductsForCategories(TreeNode parent) 
{ 
// parent.Value will be CategoryId 
// So create a WhereClause that looks like: 
// CategoryId = 34 
// If CategoryId is 34. 
string whereStr = ProductsTable.CategoryID.UniqueName + " = " + parent.Value;
foreach (ProductsRecord rec in ProductsTable.GetRecords(whereStr))
{ 
// Populate the tree node with the name of the product and Product ID. 
// ProductID will be used in the CreateWhereClause to display the correct product. 
TreeNode node = new TreeNode(rec.ProductName, rec.ProductID.ToString()); 
// No sub nodes to populate, so the PopulateOnDemand is False 
node.PopulateOnDemand = false; 
// Display as Selected 
node.SelectAction = TreeNodeSelectAction.Select; 
parent.ChildNodes.Add(node); 
} 
} 

public void Node_Changed(object sender, EventArgs e) 
{ 
// We need to refresh the Products Record panel on the right - so 
// first null out the current record by setting the RecordUniqueId = Nothing 
// Then load data on the page again. 
this.ProductsRecordControl.RecordUniqueId = null; 
LoadData(); 
}

[VB]
Code:
Public Sub Node_Populate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.TreeNodeEventArgs)
If e.Node.ChildNodes.Count = 0 Then
Select Case e.Node.Depth
Case 0
' If the parent is the top-level node, then fill with Categories
FillCategories(e.Node)
Exit Select
Case 1
' If the parent is a category (depth=1), then fill with Products for the selected Catetory
FillProductsForCategories(e.Node)
Exit Select
End Select
End If
End Sub

Private Sub FillCategories(ByVal parent As TreeNode)
Dim rec As CategoriesRecord
' Get all records - whereClause is Nothing
For Each rec In CategoriesTable.GetRecords(Nothing)
' Make sure to populate the Text as the Name, and the Value as the ID so we can
' use it later when reading the Products for the selected Category ID.
Dim node As TreeNode = New TreeNode(rec.CategoryName, rec.CategoryID.ToString)
' Populate when needed - this will ensure that only the first level is populated
' when tree is first displayed.
node.PopulateOnDemand = True
' Expand when selected.
node.SelectAction = TreeNodeSelectAction.Expand

parent.ChildNodes.Add(node)
Next
End Sub

Private Sub FillProductsForCategories(ByVal parent As TreeNode)
Dim rec As ProductsRecord
' parent.Value will be CategoryId
' So create a WhereClause that looks like:
' CategoryId = 34
' If CategoryId is 34.
Dim whereStr As String = ProductsTable.CategoryID.UniqueName & " = " & parent.Value
For Each rec In ProductsTable.GetRecords(whereStr)
' Populate the tree node with the name of the product and Product ID.
' ProductID will be used in the CreateWhereClause to display the correct product.
Dim node As TreeNode = New TreeNode(rec.ProductName, rec.ProductID.ToString)
' No sub nodes to populate, so the PopulateOnDemand is False
node.PopulateOnDemand = False
' Display as Selected
node.SelectAction = TreeNodeSelectAction.Select
parent.ChildNodes.Add(node)
Next
End Sub

Public Sub Node_Changed(ByVal sender As Object, ByVal e As EventArgs)
' We need to refresh the Products Record panel on the right - so
' first null out the current record by setting the RecordUniqueId = Nothing
' Then load data on the page again.
Me.ProductsRecordControl.RecordUniqueId = Nothing
LoadData()
End Sub

Step 7: Implement Node_Changed:  The Node_Changed method is called to whenever a user selects a leaf-node.  The intermediate nodes such as the selection of a category will not raise the  Node_Changed event.
The name of the selected index changed method (Node_Changed) is specified on the OnSelectedNodeChanged property set on the Tree View control on the layout changes.
This code is inserted into the Section 1 of the code-behind file for the page (not the Controls code-behind file).  This code can be inserted right below the Node_Populate method described above.
The Node_Changed event simply sets the UniqueId of the Product Record Control to Nothing or NULL, and calls LoadData.  The page-level LoadData function will call the LoadData for the Product Record Control and load the data for it once again.
A function defined in the next step will ensure that the currently selected product’s data will be displayed in the product record control.
[C#]
Code:
public void Node_Changed(object sender, EventArgs e) 
{ 
// We need to refresh the Products Record panel on the right - so 
// first null out the current record by setting the RecordUniqueId = Nothing 
// Then load data on the page again. 
this.ProductsRecordControl.RecordUniqueId = null; 
LoadData(); 
}

[VB]
Code:
Public Sub Node_Changed(ByVal sender As Object, ByVal e As EventArgs)
' We need to refresh the Products Record panel on the right - so
' first null out the current record by setting the RecordUniqueId = Nothing
' Then load data on the page again.
Me.ProductsRecordControl.RecordUniqueId = Nothing
LoadData()
End Sub
Step 8: Modify CreateWhereClause:  When LoadData for the ProductsRecordControl is called, it in turns calls CreateWhereClause function to create a where clause to load the data from the products table.  Normally the generated CreateWhereClause simply uses the Product Id specified by the “Products” URL parameter.
We will insert a few lines of code at the top of the CreateWhereClause to check if a product node is selected in the tree control.  If a product node is selected, we will instead use the product ID of this selected node to form the where clause.  Otherwise we will let the remainder of the generated code of CreateWhereClause handle the creation of the clause by calling the base CreateWherClause.
To override the CreateWhereClause, go to the ShowProducts.aspx page in the Application Explorer and zoom to the ShowProducts.aspx in the bread crumbs. Next, select the ProductsRecordControl in the Quick Layout.  A series of code tabs are displayed at the bottom next to the Cell Editor.  Select the CreateWhereClause() tab.  The default generated CreateWhereClause is displayed as shown below:



Copy and paste the entire CreateWhereClause function below to replace the existing CreateWhereClause.
[C#]
Code:
public override WhereClause CreateWhereClause() 
{ 
WhereClause wc = new WhereClause(); 
ProductsTable.Instance.InnerFilter = null; 
wc = new WhereClause(); 

// Find the tree view and see if a node is selected.
// If a node is selected, formulate a where clause and return it.
TreeView tv = (TreeView) this.Page.FindControlRecursively("tvCategories"); 
if (!((tv == null)) && !((tv.SelectedNode == null)) && !((tv.SelectedNode.Value == null))) { 
wc.iAND(ProductsTable.ProductID, 
BaseFilter.ComparisonOperator.EqualsTo, 
tv.SelectedNode.Value); 
return wc; 
} 

// Otherwise return the where clause specified by the generated function.
return base.CreateWhereClause(); 
}


[VB]
Code:
Public Overrides Function CreateWhereClause() As WhereClause

Dim wc As WhereClause
ProductsTable.Instance.InnerFilter = Nothing
wc = New WhereClause()

' Find the tree view and see if a node is selected.
' If a node is selected, formulate a where clause and return it.
Dim tv As TreeView = CType(Me.Page.FindControlRecursively("tvCategories"), TreeView)
If Not(IsNothing(tv)) AndAlso Not(IsNothing(tv.SelectedNode)) AndAlso _
Not(IsNothing(tv.SelectedNode.Value)) Then
wc.iAND(ProductsTable.ProductID, _
BaseFilter.ComparisonOperator.EqualsTo, _
tv.SelectedNode.Value)
Return wc
End If

' Otherwise return the where clause specified by the generated function.
Return MyBase.CreateWhereClause()
End Function 

Build and run the application to see tree view and the selected product on the right.


Step 9: (Optional) To reformat the Product Panel to align with the bottom of the TreeView simply cut and paste the two columns containg the SupplierIDLabel and field value to ReorderLevelLabel and field value as shown below.



And paste the controls under the Discontinued Label as shown below.



The final result will be a nicely formatted page with the TreeView and Products Record Panel.

Attached Images:
Click image for larger version - Name: TreeView.JPG, Views: 925, Size: 21.56 KB   Click image for larger version - Name: TreeView1.JPG, Views: 920, Size: 55.79 KB   Click image for larger version - Name: TreeView10.JPG, Views: 879, Size: 31.74 KB   Click image for larger version - Name: TreeView2.JPG, Views: 915, Size: 54.08 KB   Click image for larger version - Name: TreeView3.JPG, Views: 911, Size: 43.27 KB   Click image for larger version - Name: TreeView4.JPG, Views: 901, Size: 30.48 KB   Click image for larger version - Name: TreeView5.JPG, Views: 891, Size: 96.37 KB   Click image for larger version - Name: TreeView6.JPG, Views: 893, Size: 100.09 KB   Click image for larger version - Name: TreeView7.JPG, Views: 889, Size: 34.90 KB   Click image for larger version - Name: TreeView8.JPG, Views: 884, Size: 47.73 KB   Click image for larger version - Name: TreeView9.JPG, Views: 884, Size: 59.99 KB  


Attached Files:
doc Using_Tree_View.doc (379.00 KB, 109 views)

Thursday, April 21, 2011

How do you open a Popup from Oracle Forms

Using   web.javascript_eval_expr Statement

Example
                  web.javascript_eval_expr('window.showModelessDialog("help/SomeFile.html", "''", "dialogLeft:120px; dialogTop:260px; dialogWidth:800px; dialogHeight:455px; scroll-y:on; resizable:yes; status:no; help:no;");');
                  web.javascript_eval_expr('window.showModalDialog("help/SomeFile.html", "''", "dialogLeft:120px; dialogTop:260px; dialogWidth:800px; dialogHeight:455px; scroll-y:on; resizable:yes; status:no; help:no;");');             
                  web.javascript_eval_expr('window.open("help/SomeFile.html", "WinHelp", "location=no,menubar=no,left=220,top=260,width=800,height=455,toolbar=no,resizable=yes,scrollbars=yes");');

Integrating Oracle Forms 11g with JavaScript

Integrating Oracle Forms 11g with JavaScript


<Do not delete this text because it is a placeholder for the generated list of "main" topics when run in a browser>

Purpose

In this tutorial you set up and run an application that demonstrates Oracle Forms and JavaScript integration. The application uses Cascading Style Sheets (CSS) and a popular third party JavaScript library called jQuery.

Time to Complete

Approximately 30 minutes

Overview

The demonstration application integrates simple forms with a dHTML menu system that controls both the form and other dHTML objects appearing in the same browser window, such as a date picker and an image viewer. With this application you can demonstrate how Oracle Forms can call out to these browser widgets and call into the Oracle Forms Runtime via the Forms client applet.
The resulting application, with the menu and the date picker visible, looks like this:

Prerequisites

Before starting this tutorial, you should:
1. Have access to or have installed Oracle Forms version 11.1.1. You may use either Release 1 (R1) or Patch Set 1 (PS1), although the directory structures of these releases are somewhat different.

2. Have access to an Oracle database with the scott schema ( EMP and DEPT ) installed.
Warning: For security reasons, it may not be advisable to install the sample schemas into a production database. If you do install them, you should use passwords other than default passwords, although default passwords are used in the examples shown in tutorials provided by Oracle. When you are finished using the sample schemas for tutorial and demo purposes, you may drop them by issuing the following SQL*Plus command for each installed sample schema:
DROP USER CASCADE;
If you are using the sample schemas for the first time, you may find that you must unlock the schema user, and then grant CONNECT and RESOURCE roles to it. You can do this by using Oracle Enterprise Manager, which is part of Oracle.
Alternatively, you can issue the following SQL*Plus commands:
ALTER USER scott IDENTIFIED BY tiger ACCOUNT UNLOCK;
GRANT CONNECT, RESOURCE to scott;



3. Use Internet Explorer 7 or later. Version 6 of IE and any version of Firefox does not allow the application's JavaScript menu (a Milonic menu) to show in front of the Forms applet. However, the Milonic menu can be used with frames; see Resources.

Definitions

This demonstration uses a few Web standards that may be unfamiliar to Forms developers, such as:
  • dHTML: This acronym stands for dynamic HTML, an umbrella term for using client side languages like JavaScript, or server side languages like PHP and Java Server Pages, to create dynamic (as opposed to static) Web pages.

  • JavaScript: JavaScript has emerged as the dominant client side scripting language. Like PL/SQL, it is pointerless, but while PL/SQL is compiled to byte code, JavaScript is interpreted. It is imperative, weakly typed, and object oriented (but prototype based rather than class based), and its functions are first-class entities.

  • CSS: CSS stands for Cascading Style Sheets, which you can use to define the style of a Web site. You use it in the demonstration application to make the applet appear to be a part of the larger browser page.

  • DOM: An understanding of the DOM, or Document Object Model, is crucial in order to be effective when programming in JavaScript. The DOM is the model by which HTML objects are represented and manipulated.
See Resources for more information on these topics.

Setting Up the Application

Use following steps to setup the application:
1. From the expanded zip file, copy the .fmb files ( found in the JSInteg\Solutions\jsdemo folder) to a directory of your choice.


2 . Open the modules in Forms Builder, connect as scott, and compile the forms to the same directory as the .fmb files.


3. Copy the js.html file to the Forms configuration directory. The path for this directory is defferent depending on the release of JDeveloper that you are using:
  • For Release 1 (R1):
    \user_projects\domains\\servers\ WLS_FORMS\stage\formsapp\11.1.1\formsapp\config
  • For Patch Set 1 (PS1):
    \config\FormsComponent\forms\server\
  •  

 
4. Copy these directories: img, JSCal2, lightbox05, menu , and transEffects

and these files: jquery.js, jsdemo.css, jsdemo.html, and jsdemo.js

to the following directory:
  • For Release 1 (R1):
    \user_projects\domains\\servers\
    WLS_FORMS\stage\formsapp\11.1.1\formsapp\formsweb.war\


  • For Patch Set 1 (PS1):
    \user_projects\domains\\servers\
    WLS_FORMS\tmp\_WL_user\formsapp_11.1.1\e18uoi\war\

     

5. Edit jsdemo.html and modify the hostname and port values according to your installation. These values are located toward the end of the file.

6. Create a new configuration section called [javascript] in the formsweb.cfg file. In 11g, you could do this by using Enterprise Manager, but you can also edit the file manually. For the sake of simplicity, this tutorial shows manually editing the file.
Add some parameters to the configuration section. The defaults for height and width are a little too big for the application. The new color scheme called swan looks good for this application, so set colorscheme and lookAndFeel to accomplish that. Make sure that JavaScript support is turned on, and also name the applet.
Use the following settings:
[javascript]
width=440
height=300
splashScreen=no
background=no
colorScheme=swan
lookAndFeel=oracle
logo=no
applet_name=forms_applet
enableJavascriptEvent=true
baseHTMLjpi=js.html


7 . Edit the default.env file: Add the directory where you saved the forms to the environment variable FORMS_PATH.
For example, append to FORMS_PATH:
    ;D:\Data\MyForms\JSIntegDemo


Running the Application

To demonstrate the features of the application, perform the following steps:
1. Run the application by issuing the following URL in your browser, substituting the value for :
http://:9001/forms/jsdemo.html You do not need to invoke the servlet URL (frmservlet) because the iframe in the application calls the Forms servlet.

 
2. Use the self-explanatory JavaScript menu to navigate to submenus and perform different operations.
For example, invoke the Query menu, enter an employee name, such as WARD, in the search box, and click Go.

The form displays the record for the specified employee.


3. To redisplay all the records, select Query > Execute from the menu.

Navigate to the hiredate field in Employees form. Use the up- and down- arrow keys to scroll between records, noticing the corresponding change in the date picker calendar.

4. Select a date from the calendar, which updates the hiredate of the employee record.

5 . Select View > Departments to navigate to the Department form.

6 . Scroll up and down to navigate between different departments, noticing the changes in various images.

Summary

In this tutorial, you learned to set up and run the sample application that demonstrates JavaScript integration in Oracle Forms 11g.
The application hides the Forms standard menu and replaces its functionality with a JavaScript-based menu system. This menu is connected to the Forms applet. The application implements Javascript-based UI widgets as extensions to the Forms widget set, seamlessly making use of these widgets.

Resources

Forms 11g new features: Javascript-API / WHEN-CUSTOM-JAVASCRIPT-EVENT

Forms 11g allows the direct communication between the generic java-applet in the browser and the world around. The new JavaScript-API implements this functionality.

In Forms 11g we have a new trigger, system-variables and built-ins for the communication with the JavaScript-API.

The trigger WHEN-CUSTOM-JAVASCRIPT-EVENT fires each time, when JavaScript raises an event to forms. In the trigger we can use the payload which is stored in two system-variables. system.javascript_event_name and :system.javascript_event_value.


Informations, which were transfered from HTML to Forms, can be easily used:


In this little example we transfer in the payload the event-name "NewForm" and in the event-value the name of a form. The data is transfered from the internet-page in this way::
< INPUT id="outside_field_id">
< SCRIPT>
  function set_field (field_id, myValue) {
    document.getElementById(field_id).value=myValue;
  };
  function clickEvent1()
  {
    document.forms_applet.raiseEvent("NewForm", "payload");
  }
< /SCRIPT>
< INPUT id="button1" type="button" onClick="void clickEvent1();" value="NewForm">

Internally the method raiseEvent of the class forms_applet is used. The applet's name has to be assigned in the formsweb.cfg to the parameter applet_name.
applet_name=forms_applet

Forms can communicate bi-directional with the HTML. Therefore we can use the new built-ins web.javascript_eval_expr and web.javascript_eval_function.
web.javascript_eval_expr
    ('document.getElementById("outside_field_id").value="' ||
     :control.ti_inside || '";');
  web.javascript_eval_expr 
    ('set_field("outside_field_id", "' || :control.ti_inside
     || '")');
  :control.ti_get_value := web.javascript_eval_function
    ('document.etElementById("outside_field_id").value');

This example-code fills in the HTML-page a field named "outside_field_id" through the built-in web.javascript_eval_expr. Two techniques can be used. Direct Assignment or the call of a javascript-function, e.g. „set_field“.
You can read field through web.javascript_eval_function. The returnvalue is the value of the corresponding field in the HTML, in this case "outside_field_id".

This is another example of how important the new features in Forms 11g are. Now it's possible for forms to communicate with the world outside the browser's applet!