Quantcast
Channel: Adobe Community : All Content - LiveCycle Designer
Viewing all articles
Browse latest Browse all 5571

Script Checkc DB for Record ID Number

$
0
0

I am following an example found at PDFScripting.com and ran into a problem. I can get their script to work if my database table has at least one record. But if my database table is brand new with no records, the script fails because it looks for the value in the first record, first column. How do I modify the script to handle when there are no records? I think I need to add an else statement but can't get one to work. (It fails on their example form too)

 

 

// Walk Order DB to find highest Order Number
var nMaxID = 0;// Reset Database to first Record
var oDB = xfa.sourceSet.OrderInfo;try{  oDB.first();}catch(e){  oDB.open();  oDB.first();}// Walk through all records to find the latest Order IDwhile(!oDB.isEOF()){    if(xfa.record.OrderInfo.OrderID.value > nMaxID)        nMaxID = Number(xfa.record.OrderInfo.OrderID.value);    oDB.next();}
oDB.close();
OrderID.rawValue = nMaxID + 1; 

Viewing all articles
Browse latest Browse all 5571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>