You are currently browsing the archives for the LANSA category.
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Mar | ||||||
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | |||
- CSS (2)
- Javascript (3)
- LANSA (21)
- SQL (8)
- Twitter API (1)
- Uncategorized (25)
- 8. March 2010: American Express is Suing Me
- 28. January 2010: So frackin hard
- 1. September 2009: Twitter API STREAM Filter
- 15. June 2009: DOS Commands that work on Windows XP
- 14. April 2009: TWEATER CHEATER IS BORN
- 14. April 2009: Windows Keyboard Short Cuts - ALT F4 is my Favorite
- 11. April 2009: SELECT_SQL Examples
- 30. January 2009: My Recovery ID Idea
- 29. January 2009: Test Program to See what LANSA Services are Licensed
- 11. January 2009: glossary
Archive for the LANSA Category
SELECT_SQL Examples
11. April 2009 by admin.
SELECT_SQL FIELDS((#W_COUNT ‘count(*)’)) FROM_FILES((REQUEST )) WH
ERE(’CLIENT_ID = :RITAID AND STATUS_CODE = 4 AND BA
TCH_SEQ_NUM = 0′)
ENDSELECT
SELECT_SQL FIELDS((#CRGUID ) (#CRTED ) (#CROBATCH ) (#CRBATCH ) (#
CRCCNO ) (#CREXPDT ) (#CRAMNT ) (#CRSWIPE ) (#CRQOVR )
(#CRRITAS ) (#CRRITAID ) (#CRTCN ) (#CRMUSR ) (#CRCCET
) (#CRORIG ) (#CRFAIR )) FROM_FILES((CRTRAN )) WHERE(’S
UBSTR(CROBATCH,1,2) = :XBFRGN AND CRSWIPE <> :WSWIPE AN
D (CRRITAS = 5 OR (CRRITAS = 200 AND CRAMNT < 0))’) ORD
ER_BY(’CROBATCH,CRBATCH’)
********** OK to Mark for Completion
SELECT_SQL FIELDS((#W_COUNT ‘count(*)’) (#W_SUM ‘SUM(INT(TRANS_AMO
UNT))’)) FROM_FILES((REQUEST )) WHERE(’CLIENT_ID = :RIT
AID AND STATUS_CODE = 4 AND BATCH_SEQ_NUM = 0 AND C
OMMAND =:COMMND’) IO_STATUS(#W_IOSTS) IO_ERROR(*NEXT)
ENDSELECT
********** put decimal place in amount
SUBROUTINE NAME(GETRITASTS)
**********
SELECT_SQL FIELDS((#INTRN0001 ‘INTRN_SEQ_NUM’) (#STATU0001 STATU00
001)) FROM_FILES((REQUEST )) WHERE(’ORIG_SEQ_NUM = :WRT
AID’) ORDER_BY(STATU00001) IO_ERROR(*NEXT)
LEAVE
ENDSELECT
**********
IF_NULL FIELD(#INTRN0001)
SELECT_SQL FIELDS((#INTRN0001 ‘INTRN_SEQ_NUM’) (#STATU0001 STATU00
001)) FROM_FILES((REQUEST )) WHERE(’INTRN_SEQ_NUM= :WRT
AID’) ORDER_BY(STATU00001) IO_ERROR(*NEXT)
LEAVE
ENDSELECT
SELECT_SQL FIELDS((#W_COUNT ‘count(*)’)) FROM_FILES((REQUEST )) WH
ERE(’CLIENT_ID = :WRITAI AND STATUS_CODE = :WRITAS AND
BATCH_SEQ_NUM = 0′)
ENDSELECT
Posted in SQL, LANSA | 1 Comment »
Test Program to See what LANSA Services are Licensed
29. January 2009 by admin.
FUNCTION OPTIONS(*DIRECT)
*
DEFINE FIELD(#W_SERVICE) TYPE(*CHAR) LENGTH(30)
DEFINE FIELD(#W_STS) TYPE(*CHAR) LENGTH(20)
DEFINE FIELD(#W_MSG) TYPE(*CHAR) LENGTH(80)
DEF_LIST NAME(#LICENSE) FIELDS(#W_SERVICE) TYPE(*WORKING)
DEF_LIST NAME(#DLICENSE) FIELDS(#W_SERVICE #W_STS #W_MSG)
*
CLR_LIST NAMED(#LICENSE)
CLR_LIST NAMED(#DLICENSE)
*
EXECUTE SUBROUTINE(ADD) WITH_PARMS(’XMLCLIENT’)
EXECUTE SUBROUTINE(ADD) WITH_PARMS(’FTPCLIENT’)
EXECUTE SUBROUTINE(ADD) WITH_PARMS(’POPCLIENT’)
EXECUTE SUBROUTINE(ADD) WITH_PARMS(’SMTPCLIENT’)
EXECUTE SUBROUTINE(ADD) WITH_PARMS(’HTTPCLIENT’)
EXECUTE SUBROUTINE(ADD) WITH_PARMS(’HTTPIXMLCLIENT’)
EXECUTE SUBROUTINE(ADD) WITH_PARMS(’HTTPOXMLCLIENT’)
EXECUTE SUBROUTINE(ADD) WITH_PARMS(’HTTPIEDICLIENT’)
EXECUTE SUBROUTINE(ADD) WITH_PARMS(’HTTPOEDICLIENT’)
EXECUTE SUBROUTINE(ADD) WITH_PARMS(’HTTPISVCLIENT’)
EXECUTE SUBROUTINE(ADD) WITH_PARMS(’SQLCLIENT’)
EXECUTE SUBROUTINE(ADD) WITH_PARMS(’MQCLIENT’)
EXECUTE SUBROUTINE(ADD) WITH_PARMS(’CECLIENT’)
EXECUTE SUBROUTINE(ADD) WITH_PARMS(’FILECLIENT’)
EXECUTE SUBROUTINE(ADD) WITH_PARMS(’SVFILECLIENT’)
EXECUTE SUBROUTINE(ADD) WITH_PARMS(’EDICLIENT’)
EXECUTE SUBROUTINE(ADD) WITH_PARMS(’RFICLIENT’)
EXECUTE SUBROUTINE(ADD) WITH_PARMS(’SOAPCLIENT’)
EXECUTE SUBROUTINE(ADD) WITH_PARMS(’AS2CERT’)
EXECUTE SUBROUTINE(ADD) WITH_PARMS(’AS2SERVER’)
EXECUTE SUBROUTINE(ADD) WITH_PARMS(’AS2CLIENT’)
EXECUTE SUBROUTINE(ADD) WITH_PARMS(’AS2RECEIPT’)
EXECUTE SUBROUTINE(ADD) WITH_PARMS(’UCCNETCLIENT’)
*
*
* DEFINE FIELD(#JSMSTS) TYPE(*CHAR) LENGTH(20)
* DEFINE FIELD(#JSMMSG) TYPE(*CHAR) LENGTH(255)
* DEFINE FIELD(#JSMCMD) TYPE(*CHAR) LENGTH(255)
* INPUT_ATR(LC)
*
* Load and Each Service
*
SELECTLIST NAMED(#LICENSE)
EXECUTE SUBROUTINE(TEST) WITH_PARMS(#W_SERVICE)
ENDSELECT
*
* Close
*
DISPLAY BROWSELIST(#DLICENSE)
RETURN
*
* Build Service List
SUBROUTINE NAME(ADD) PARMS(#W_SERVICE)
ADD_ENTRY TO_LIST(#LICENSE)
ENDROUTINE
* Test Each Service
SUBROUTINE NAME(TEST) PARMS(#W_SERVICE)
*
USE BUILTIN(JSM_OPEN) TO_GET(#JSMSTS #JSMMSG)
*
USE BUILTIN(TCONCAT) WITH_ARGS(’SERVICE_LOAD SERVICE(’ #W_SERVICE ‘)’) TO_GET(#JSMCMD)
USE BUILTIN(JSM_COMMAND) WITH_ARGS(#JSMCMD) TO_GET(#JSMSTS #JSMMSG)
CHANGE FIELD(#W_STS) TO(#JSMSTS)
CHANGE FIELD(#W_MSG) TO(#JSMMSG)
ADD_ENTRY TO_LIST(#DLICENSE)
USE BUILTIN(JSM_COMMAND) WITH_ARGS(’SERVICE_UNLOAD’) TO_GET(#JSMSTS #JSMMSG)
*
USE BUILTIN(JSM_CLOSE) TO_GET(#JSMSTS #JSMMSG)
*
ENDROUTINE
Posted in LANSA | 1 Comment »
glossary
11. January 2009 by admin.
| Cart | See Shopping Cart. |
| Confirmed Order | Once a Shopping Cart has been checked out, the cart becomes a Confirmed Order with an assigned Order Number. Do not confuse Confirmed Orders with Saved Cart (sometimes called a Saved Order) or Pending Carts (sometimes called Pending Orders). |
| Check Out | Check Out is the process by which a Shopping Cart is converted to a Confirmed Order. |
| Customer | A Customer is someone who is placing an Order for your Products. Customers must have a valid Web user profile to access the System. |
| Customer Account | The B2C Customer Account information includes the contact, billing and shipping details. For B2B Customer Accounts, only the Contact information is stored in the Commerce Edition database. The remaining B2B information comes from the back-end files. |
| Order | The term “Order” can be used in a number of ways. To be specific, Commerce Edition creates Shopping Carts, Pending Carts and Confirmed Orders. When a Customer places an “Order”, the customer may be using any of these three specific types of Business Objects. Only Confirmed Orders will have any meaning to your existing application database. |
| Pending Cart | A Pending Cart (sometimes called a Pending Order) is a Shopping Cart which was not completed during a previous session by the Customer. If a Customer leaves the Web site with Products in the Shopping Cart (or if the Web site connection is lost), the Shopping Cart is automatically converted into a Pending Cart. When the Customer next logs onto your site, a list of Pending Carts is displayed. The user may select one of these Pending Carts or the user can save or delete these Pending Carts. |
| Personal Catalog | A Personal Catalog is a subset of the Product Catalog. It is a Customer specific list of Products which are frequently ordered. The Customer can add or delete products in their own Personal Catalog. This catalog is maintained as a file in the Commerce Edition database. |
| Product | A Product is any item which the Customer orders. Products are based on your existing back-end Product file(s). |
| Product Catalog | The Product Catalog is a listing of the Products which a customer may order. The Product Catalog is based on your existing back-end Product files. There is no separate Product Catalog file in the Commerce Edition database. |
| Promotion | A Promotion is a special offer which is advertised on the Web site. Promotions are simply text. There is no processing logic associated with a promotion. |
| Saved Cart | A Saved Cart (sometimes called a Saved Order), is simply a saved list of products. A Shopping Cart can be saved so that the Products may be easily reordered. Saved Carts can be added to the active Shopping Cart. |
| Session ID | A Session ID (sometimes called a Web Session ID), is a unique number assigned when a Web user logs on to the system and creates a Shopping Cart. A Session ID is assigned to a Shopping Cart and is stored as part of the definition of a Pending Cart. After a Shopping Cart is checked out, a new Session ID is assigned for the new Shopping Cart. |
| Ship-To Address | The Ship-To address is the location where the Products will be delivered. For B2C Customers, the Ship-To information is stored in the Commerce Edition database. For B2B Customers, the Ship-To information is stored in the back-end files. |
| Shopping Cart | A Shopping Cart is simply a list of products which the Customer may wish to purchase. Each Shopping Cart is associated with a unique Session ID. |
| Up-Selling | The means by which suggested or accessorial products are listed when browsing the Product Catalog, the Personal Catalog or the Shopping Cart. |
| Web User | A Web user is any Customer who has logged on to the system. Each Web user has an unique user profile/ID and password. For B2C, a Customer and Web user are the same, as each Customer has just one Web user profile. For B2B, a single Web user profile can be associated to more than one Customer account. Your system administrator can create associations between Web users and your B2B Customer accounts. (Note: A Customer Account can have only one Web user associated with it, but a Web user can be associated with more than one Customer Account.) |
Posted in LANSA | No Comments »
What is B2B and B2C?
11. January 2009 by admin.
There are many industry definitions for Business-to-Business (B2B) and Business-to-Consumer (B2C) applications. To develop your application with Commerce Edition, you must understand a basic distinction between B2B and B2C from a Commerce Edition application business model perspective.
Both B2B and B2C applications allow Customers to place Orders for Products. The main difference between B2B and B2C is the definition of the Customer.
In a B2B application, a Customer is a predefined Business Partner. You have a predefined business relationship with the Customer before they access your e-business application. Your existing applications will already contain data for this Customer. You will probably set up the Web user accounts for the Business Partner in advance. Customer Numbers are already defined and can be validated against your existing database.
In a B2C application, a Customer is any Web user or the general public consumer. You do not know anything about the Customer until they place their first order. The Customer must register or set up their own account in order to place orders. You have no information for the Customer in your existing database. A Customer may register to place only one order.
This distinction will help you understand the Commerce Edition data model and basic rules for validation and processing. The Commerce Edition database has been designed to support both B2B and B2C applications. If you are implementing only a B2C application, you may not require some files and fields created specifically for B2B applications. If you are implementing only a B2B application, you may not require some files and fields created specifically for B2C applications.
The Commerce Edition database will also support a combined B2B and B2C application. A combined application allows you to create one Web site, which allows your existing Customers (B2B) and new Web users (B2C) to order products. Depending on whether the Customer is B2B or B2C, Commerce Edition will perform the appropriate processing logic and will use the appropriate database files.
Posted in LANSA | No Comments »
What is Commerce Edition?
11. January 2009 by admin.
The LANSA for the Web Commerce Edition is a set of tools, which enables LANSA for the Web developers to rapidly deploy Business-to-Consumer (B2C) and Business-to-Business (B2B) applications that integrate with existing back-end or legacy systems. Commerce Edition provides an application framework which extends the power of LANSA for the Web specifically for B2C and B2B development.
Commerce Edition includes a customizable application database for your B2B and B2C applications. Using Business Objects, you create the framework for your application. Without any manual coding by your developers, Commerce Edition can deliver anywhere from 60% to 85% of your finished application.
Commerce Edition uses the LANSA for the Web e-Business Framework Wizard, which allows you to quickly and easily customize the presentation of your LANSA Web application. The Wizard is not used to create your LANSA functions. It is used to alter their appearance, by using Web-based functions executing from your browser. The Wizard removes the need to manually define graphical variables and Web components. You can change the user navigation within your application and you can change the look-and-feel of your applications without having to recompile any of the functions in your application.
Posted in LANSA | No Comments »
What is LANSA for the Web?
11. January 2009 by admin.
LANSA for the Web allows you to build Web applications quickly and easily. It is a toolkit that integrates seamlessly with the LANSA Application Development Environment (either Visual LANSA or LANSA for the iSeries). You can use graphical HTML forms or XML based applications using the same Repository and RDML skill set used to build your iSeries and Windows applications. In fact, a LANSA program can be deployed to the iSeries, Windows or the Web using a single RDML program definition.
LANSA for the Web allows you to build dynamic data retrieval applications for the Web. It also allows you to deploy the applications across a number of combinations of platforms including the iSeries and Windows NT. Each of these platforms can be used as the Application/Data Server or the Web Server. In other words, you can choose to deploy your applications in a multi-tiered architecture.
LANSA for the Web incorporates a Transaction Server, which provides your user sessions with a persistent connection between their browser and your Data Server. Persistent connections are not available in the HyperText Transfer Protocol (HTTP), the protocol used in serving the Web.
LANSA for the Web shields you from the technologies you have to learn to deploy Web-enabled applications. You do not need to have a thorough knowledge of CGI or Java Servlet programming, HTML or JavaScript or XML. You do not need to learn code-intensive HTML or CGI to build dynamic Web applications. All you have to do is use LANSA’s repository-based 4GL environment to build your application definition. LANSA will automatically generate the HTML or XML pages for you. LANSA for the Web allows the developer to work at the 4GL level, without the need for any skills in HTML, CGI or any other Internet programming interfaces. LANSA for the Web hides the complexity of HTML/XML and CGI programming from you.
There is no client side code to develop or maintain with LANSA for the Web. You do not have to be concerned about the operating systems of the client. All the client machines require is a browser that is capable of supporting the HTML generated by LANSA for the Web. Once you have indicated that you want your LANSA application Web-enabled, LANSA will automatically take care of the effort to Web-enable the application for you.
The huge growth and demand for Internet access to businesses has prompted LANSA to extend its offering beyond the traditional application development environment. LANSA now offers a set of application specific frameworks to help companies deploy their e-business solutions at an even more astounding rate.
The LANSA e-Business Framework Wizard and Commerce Edition are part of the natural evolution of the LANSA product family. Along with LANSA’s powerful application development environment, Web developers will benefit from Commerce Edition (which includes the Database Adaptor and Business Objects) and the e-Business Framework Wizard to help accelerate Business-to-Consumer (B2C) and Business-to-Business (B2B) application development.
Posted in LANSA | No Comments »
What is LANSA?
11. January 2009 by admin.
LANSA is an integrated family of highly productive design, development and maintenance products for multi-platform host and network applications. This family of products provides an extremely flexible application development environment where a developer can use a single skill set to build and deploy applications for the iSeries, Windows or Internet environments.
LANSA’s powerful Repository-based 4GL has enabled developers to quickly deploy applications across computing boundaries and across computing paradigms. A simple recompile can transform a host-centric iSeries application using RPG/ILE into a client/server Windows application using C/C++ or a browser-based, Internet application using HTML and Java servlets.
Developer productivity and ease-of-use are LANSA trademarks. For years, developers have enjoyed the benefits of LANSA’s Rapid Development and Maintenance Language (RDML) which insulated them from low-level languages and platform complexities. RDML can build iSeries applications, graphic event-driven Windows applications and Web applications. The LANSA Active-Object Repository provides a centralized application definition and platform independent database architecture. This powerful combination has protected companies’ information technology investments for over 10 years.
LANSA was the first iSeries development tool to fully embrace the Internet and Web technology. LANSA for the Web has allowed developers to construct Internet, Intranet and Extranet applications. Today, there are hundreds of thousands of people using LANSA Web-based applications in retail, health care, insurance, manufacturing, government, communications and in many other industry sectors.
Posted in LANSA | No Comments »
Visual lansa job
24. December 2008 by admin.
Candidate must be willing to work and be responsible for entire project (start to finish). Good problem analysis skills and smart. We want someone who is looking for a career and not just a job. We are a small company (13 people with only 4 in development). Our current developers are RPG and we are looking for a quality person to come in and lead us in our rewrite in plums using the Lansa framework.
CAll 877 526 7220 or email resume to lansa@yahoo.com
Posted in LANSA | No Comments »
EDPX RDML
15. August 2008 by admin.
FUNCTION OPTIONS(*DIRECT *WEBEVENT)
GROUP_BY NAME(#PRMTBLGRP) FIELDS(#MPRMCTG #MPRMCOD #MPRMDSC)
DEF_LIST NAME(#ARRAY_LST) FIELDS(#Z_DATA) COUNTER(#Z_COUNT) TYPE(*WORKING) ENTRYS(500)
DEF_LIST NAME(#X1BL01LST) FIELDS(#X1ALPLONG) ENTRYS(1000)
DEFINE FIELD(#ZZCOUNT) TYPE(*DEC) LENGTH(2) DECIMALS(2)
DEFINE FIELD(#ZZCOUNTC) TYPE(*CHAR) LENGTH(2)
DEFINE FIELD(#ZFNAMEMMM) TYPE(*CHAR) LENGTH(25)
DEFINE FIELD(#ZLNAMEMMM) TYPE(*CHAR) LENGTH(25)
DEFINE FIELD(#ZSSNUMMMM) TYPE(*CHAR) LENGTH(25)
* =======================================================
* Moving Respective HTML Pages to Components
* =======================================================
CHANGE FIELD(#DCTONLCMP) TO(*NULL)
CHANGE FIELD(#DCTHEDCMP) TO(PAG_RPARRHED)
CHANGE FIELD(#DCTHDRCMP) TO(*NULL)
CHANGE FIELD(#DCTLFTCMP) TO(*NULL)
CHANGE FIELD(#DCTPAGCMP) TO(PAG_RPARRAY)
* =======================================================
* Process according to Button clicked
* =======================================================
CASE OF_FIELD(#STDRENTRY)
WHEN VALUE_IS(’*EQ N’)
* do logic here to validate if you want to
REQUEST FIELDS(#ZFNAMEMMM #ZLNAMEMMM) EXIT_KEY(*NO) MENU_KEY(*NO)
WHEN VALUE_IS(’*EQ *BLANKS’)
CHANGE FIELD(#MPRMCTG) TO(PENDC)
CHANGE FIELD(#MPRMCOD) TO(”’RPARRAY1”’)
CLR_LIST NAMED(#ARRAY_LST)
CLR_LIST NAMED(#X1BL01LST)
SELECT FIELDS(#PRMTBLGRP) FROM_FILE(M@PRMTBL) WITH_KEY(#MPRMCTG #MPRMCOD) GENERIC(*YES)
EXECUTE SUBROUTINE(LISTENTRY) WITH_PARMS(#MPRMDSC)
ENDSELECT
* Build List for Javascript Array
CHANGE FIELD(#ZZCOUNT) TO(0)
SELECTLIST NAMED(#ARRAY_LST)
CHANGE FIELD(#X1ALPLONG) TO(#Z_DATA)
ADD_ENTRY TO_LIST(#X1BL01LST)
ENDSELECT
OTHERWISE
MESSAGE MSGTXT(’STDRENTRY not Programmed for’)
ENDCASE
REQUEST FIELDS((#STDNEXT *HIDE) (#STDRENTRY *HIDE)) EXIT_KEY(*NO) MENU_KEY(*NO) PROMPT_KEY(*NO)
REQUEST BROWSELIST(#X1BL01LST) EXIT_KEY(*NO) MENU_KEY(*NO)
* =======================================================
* Subroutine ….: LISTENTRY
* Description….: Add Entries to List
* =======================================================
SUBROUTINE NAME(LISTENTRY) PARMS(#Z_DATA)
IF_NULL FIELD(#Z_DATA)
ELSE
ADD_ENTRY TO_LIST(#ARRAY_LST)
ENDIF
ENDROUTINE
Posted in LANSA | No Comments »
EDPX HED COMPONENT
15. August 2008 by admin.
<!– ############################################## –>
<!– ### !@BEGIN Page Component PAG_HED ### –>
<!– ############################################## –>
<script type=”text/JavaScript”>
<!–
//* This is an attempt to eventually pull out the file level
//* validations from the LANSA repository to be applied on client side
function validateForm()
{
var myattr=new Array();
bldAttrArray(myattr);
if(chkreqelements(myattr,’form’))
{mapValuesBack();return(true);} else {return(false);}
if(customValidations) {return(true);} else {return(false);}
}
function validateField(vfieldobj)
{
var myfieldobj=vfieldobj;
var myfieldattr=new Array();
bldFieldAttrArray(myfieldobj,myfieldattr);
if(!chkreqelements(myfieldattr,’field’)) ErrField(myfieldobj);
}
function bldAttrArray(bldattrarr)
{
var attstr=”what is in new array\n\n”;
var attnodeName=”";
var attnodeValue=”";
var k=0;
for(i=0;i<document.LANSA.elements.length;i++)
{
for(j=0;j<document.LANSA.elements[i].attributes.length;j++)
{
attnodeName=document.LANSA.elements[i].attributes[j].nodeName.toUpperCase();
if(attnodeName==”EDPX”)
{
attnodeValue=document.LANSA.elements[i].attributes[j].nodeValue;
attnodeValue=attnodeValue.toUpperCase();
k=bldattrarr.length;
bldattrarr[ k ]=document.LANSA.elements[i].id+”:”+attnodeValue;
attstr += bldattrarr[ k ]+” “;
attstr += “\n”;
}
}
}
//* remove comment bellow to see all EDPX elements in form
//*alert( attstr );
}
function bldFieldAttrArray(fieldobj,fieldattarr)
{
var fieldattobj=fieldobj;
var fieldattstr=”what is in field array\n\n”;
var fieldattnodeName=”";
var fieldattnodeValue=”";
var k=0;
for(j=0;j<fieldattobj.attributes.length;j++)
{
fieldattnodeName=fieldattobj.attributes[j].nodeName.toUpperCase();
if(fieldattnodeName==”EDPX”)
{
fieldattnodeValue=fieldattobj.attributes[j].nodeValue;
fieldattnodeValue=fieldattnodeValue.toUpperCase();
k=fieldattarr.length;
fieldattarr[ k ]=fieldattobj.id+”:”+fieldattnodeValue;
fieldattstr += fieldattarr[ k ]+” “;
}
}
fieldattstr += “\n”;
//* remove comment bellow to see all EDPX elements in form
//* alert(fieldattstr);
}
function chkreqelements(attarr,atttyp)
{
var cremsg=”The Following errors have been found: “;
//* For LANSA users Messages can be put in a browse list *NOBICP then do a merge list here
var crems00=”is required and must be entered”
var crems01=”has bad address “;
var crems02=”has invalid characters a-z A-Z “;
var crems03=”has invalid characters a-z A-Z 0-9 “;
var crems04=”is not a number “;
var crems05=”can not be a number “;
var crems06=”is invalid date “;
var crems07=”is not an acceptable range for Date of Birth “;
var crems08=”is invalid format ###-##-#### “;
var crems09=” “;
var crems10=” “;
var crems11=” “;
var crems12=” “;
var crems13=” “;
var crems14=” “;
var crems15=” “;
var crems99=”ERROR COUNT -> “;
var creid=”";
var creval=”";
var crestr=”";
var dotdot=0;
var creobj=”";
var crereq=”";
var cretyp=”";
var cretxt=”";
var errcnt=0;
var cretmp=”";
cremsg += “\n\n”;
for(i=0;i<attarr.length;i++)
{
crestr=attarr[i];
dotdot=crestr.indexOf(”:”);
creid=crestr.substr(0,dotdot);
creval=crestr.substr(dotdot+1,crestr.length-1);
crereq=creval.match(”REQ”);
creobj=document.getElementById(creid);
creobj.value=trimTrailingBlanks(creobj.value);
credesc=creobj.name;
if(creobj.title) {credesc=creobj.title;}
if(creobj.value.length == 0)
{
//* Format of message here
cretmp=credesc+” as NULL => ”
if(creval.match(”REQ”)) {errcnt=errcnt+1;cremsg +=cretmp+crems00+”\n”;}
}
else
{
//* Format of message here
cretmp=credesc+” as “+creobj.value+” => ”
//* Add new validation checks here
if(creval.match(”EML”)) {if(!emailValidator(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems01+”\n”;}}
if(creval.match(”A2Z”)) {if(!isAlpha(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems02+”\n”;}}
if(creval.match(”A29″)) {if(!isAlphanumeric(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems03+”\n”;}}
if(creval.match(”NUM”)) {if(!isNumeric(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems04+”\n”;}}
if(creval.match(”NAN”)) {if(isNumeric(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems05+”\n”;}}
if(creval.match(”DTE”)) {if(!dmyValidator(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems06+”\n”;continue}}
if(creval.match(”DOB”)) {if(!dmyValidator(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems07+”\n”;}}
if(creval.match(”SSN”)) {if(!isSSN(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems08+”\n”;}}
if(creval.match(”ZIP”)) {if(!isZipcodeUSA(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems09+”\n”;}}
if(creval.match(”ZZZ”)) {if(!dummyValidator(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems10+”\n”;}}
if(creval.match(”ZZZ”)) {if(!dummyValidator(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems11+”\n”;}}
if(creval.match(”ZZZ”)) {if(!dummyValidator(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems12+”\n”;}}
if(creval.match(”ZZZ”)) {if(!dummyValidator(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems13+”\n”;}}
if(creval.match(”ZZZ”)) {if(!dummyValidator(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems14+”\n”;}}
if(creval.match(”ZZZ”)) {if(!dummyValidator(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems15+”\n”;}}
}
}
if(errcnt!= 0)
{
if(errcnt!=1) cremsg+=”\n”+crems99+errcnt;
if(atttyp==’form’) alert( cremsg );
return(false);
}
else
{return(true);}
}
function trimTrailingBlanks(TrimtrailingblanksValue)
{trim=TrimtrailingblanksValue;
if (trim.length==0) return trim;
for (var i=trim.length-1;i>=0;i–) if (trim.substring(i,i+1) !=’ ‘) {i++;break;}
if (i<0) i=0;
trim=trim.substring(0,i);
return trim;
}
//* ==============================================
//* Validation functions — Add new functions here
//* ==============================================
function isNumeric(elem){
var numericExpression = /^[0-9]+$/;
if(elem.value.match(numericExpression)){
return true;
}else{ return false;}
}
// If the element’s string matches the regular expression it is all letters
function isAlpha(elem){
var alphaExp = /^[a-zA-Z]+$/;
if(elem.value.match(alphaExp)){
return true;
}else{ return false;}
}
// If the element’s string matches the regular expression it is numbers and letters
function isAlphanumeric(elem){
var alphaExp = /^[0-9a-zA-Z]+$/;
if(elem.value.match(alphaExp)){
return true;
}else{ return false;}
}
function lengthRestriction(elem, min, max){
var uInput = elem.value;
if(uInput.length >= min && uInput.length <= max){
return true;
}else{ return false;}
}
function emailValidator(elem){
var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
if(elem.value.match(emailExp)){
return true;
}else{ return false;}
}
function dummyValidator(elem){
if(elem==elem){
return true;
}else{ return false;}
}
function ssnValidation(elem) {
var ssn = elem.value;
var matchArr = ssn.match();
var numDashes = ssn.split(’-').length - 1;
if (matchArr == null || numDashes == 1 || (parseInt(matchArr[1],10)==0)) {return false;} else { return true;}}
function isSSN(elem){
var numericExpression = /^(\d{3})-?\d{2}-?\d{4}$/;
if(elem.value.match(numericExpression)){
return true;
}else{ return false;}
}
function isZipcodeUSA(elem)
{
var iszip = elem.value;
var numDashes = elem.value.split(’-').length - 1;
var islength = elem.value.length;
if (islength == 5)
{
if(isNumeric(elem))
{
return true;
} else { return false;}
}
}
//#######################################
//### Highlight/Unhighlight Focused Input Fields
//#######################################
function focusWork(focusworkThis,focusworkEvent)
{var Event=focusworkEvent;
var This=focusworkThis;
if (Event.type==’focus’) This.style.backgroundColor=’Yellow’;
if (Event.type==’blur’)
{ This.style.backgroundColor=’White’;
validateField(This);}
}
//#######################################
//### Error Notify Red Background Fields
//#######################################
function ErrField(errfieldThis)
{ var This=errfieldThis;
This.style.backgroundColor=’Pink’;
}
function isCustom()
{
//* Put your custom specific validations here (false=fail)
if(’a’ == ‘a’) {return(true);}
else {return false;}
}
function switchInputType(SwitchinputtypeBase,SwitchinputtypeObjectID)
{
var objectSW=document.getElementById(SwitchinputtypeObjectID);
var baseSW=SwitchinputtypeBase;
baseSW.value=objectSW.value;
var masag=’Value is/’+baseSW.value;
alert(masag);
debugAlert(baseSW);
}
function mapValuesBack()
{
//switchInputType(document.LANSA.AZFNAMEMMM,’FNAME’);
//switchInputType(document.LANSA.AZLNAMEMMM,’LNAME’);
document.LANSA.ASTDRENTRY.value=’N';
HandleEvent(’<RDML MERGE=”*PROCESS”>’,'<RDML MERGE=”*FUNCTION”>’);
}
//#####################################################
//### Alert to Show Object Properties
//#####################################################
function debugAlert(AlertObject)
{ var i = 0 ; a = “”;
// list all window properties in a variable
for ( property in AlertObject )
{a += ( i ) + ” ” + property + “…”;
i ++;
if(i % 5 == 0) a += “\n”;
}
// display the window properties list
alert( a );
}
//–>
</script>
<!– ############################################## –>
<!– ### !@END Page Component PAG_HED ### –>
<!– ############################################## –>
Posted in Javascript, LANSA | No Comments »