Archive for November, 2009

How to remove the padded spaces after the Month in SQL

Monday, November 23rd, 2009

It appears that when you specify to display the value for the full month, a space is added to the end of the result. In the following example, in the result you will see that between ‘November’ and ‘-2009’, there is a space.

< pre lang=”php” ><code>

SELECT
    to_char(systimestamp, ‘dd-Month-yyyy’)
FROM
    dual;

</code></pre>

Result: ’23-November -2009′

To remove this space, there are two ways to accomplish this. The first example uses the ‘FM’ flag:

SELECT
    to_char(systimestamp, ‘dd-FMMonth-yyyy’)
FROM
    dual;

Result: ’23-November-2009′

The second way to accomplish this is to use the Trim command around the Month. In order to do this, you must break the date command up into parts.:

SELECT
    to_char(systimestamp, ‘dd’) || ‘-‘ || trim(to_char(systimestamp, ‘Month’)) || ‘-‘ || trim(to_char(systimestamp, ‘yyyy’)) FROM
    dual
;

Result: ’23-November-2009′

Using Java to Read Record Data in ClassForm for ARS 7.0

Sunday, November 22nd, 2009

Using Java to Read Record Data in ClassForm for ARS 7.0

////////////////////////////////////////////////////////////////////////////
///Start Query Records By Qualification/////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////

Entry entry;
//Prepare to Query a Form on ARSystem 7.0

NameID formName = new NameID(getClassName());
//Set the Field criteria to retrieve all field info
//———————————————————————-
FieldCriteria fCriteria = new FieldCriteria();
fCriteria.setRetrieveAll(true);

//Retrieve all types of fields
//———————————————————————-
FieldListCriteria fListCrit =
new FieldListCriteria(formName, new Timestamp(0),
FieldType.AR_ALL_FIELD);

//Load the field array with all fields in the test form
//———————————————————————-
Field[] formFields = FieldFactory.findObjects(userInfo,
fListCrit, fCriteria);

//Create the search qualifier
//———————————————————————-
QualifierInfo myQualifier = Util.ARGetQualifier(userInfo,
getSearchString(), formFields, null,
Constants.AR_QUALCONTEXT_DEFAULT);

FieldFactory.getFactory().releaseInstance(formFields);

//Set the EntryListCriteria
//———————————————————————-
EntryListCriteria listCriteria = new EntryListCriteria();
listCriteria.setSchemaID(formName);
listCriteria.setQualifier(myQualifier);

//Define which fields to retrieve in the results list
//Note that the total width including separators must be <256 chracters
//Here the total width=15+12+25+3*1=58
//3*1 is three separators of 1 character each
//———————————————————————-
EntryListFieldInfo[] entryListFieldList =
new EntryListFieldInfo[getUsedFieldIds().length];

for (int i = 0; i < getUsedFieldIds().length; i++) {
entryListFieldList[i] = new EntryListFieldInfo(
new FieldID(Long.parseLong(getUsedFieldIds()[i].toString())),
5, ” “);
}
//Set the Entry Criteria
//———————————————————————-
EntryCriteria criteria = new EntryCriteria();
criteria.setEntryListFieldInfo(entryListFieldList);

//Make the call to retrieve the query results list
Integer nMatches = null;

//Set it to false to return all entries regardless of locale
//———————————————————————-
Entry[] entryInfo = EntryFactory.findObjects(userInfo,
listCriteria, criteria, false, nMatches);

log.debug(“Query returned===” + entryInfo.length + ” matches.”);

for (int i = 0; i < entryInfo.length; i++) {

for (int ii=0;ii<entryInfo[i].getEntryItems().length-1;ii++)  {

try {

log.debug(ii+ “.)Value===” + entryInfo[i].getEntryItems()[ii].getValue().toString() + “====” );

} catch (NullPointerException ex) {
log.debug(i + “.)” + ex.getLocalizedMessage());
}

}
}

///////////////////////////////////////////////////////////////////////////////
///End Query Records By Qualification/////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

Using Java to Read Record Data in ClassForm for ARS 7.1

Sunday, November 22nd, 2009

Using Java to Reading Record Data in ClassForm for ARS 7.1

////////////////////////////////////////////////////////////////////////////////
///Start Query Records By Qualification/////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//Set the Field criteria to retrieve all field info
//———————————————————————-
List<Field> fields = userInfo.getListFieldObjects(formName);

//Create the search qualifier
//———————————————————————-
QualifierInfo myQualifier = userInfo.parseQualification(getQueryString(),
fields, null, Constants.AR_QUALCONTEXT_DEFAULT);

OutputInteger nMatches = new OutputInteger();
List<SortInfo> sortOrder = new ArrayList<SortInfo>();
sortOrder.add(new SortInfo(2, Constants.AR_SORT_ASCENDING));
int[] fieldIds = intArray.getIntArray(getUsedFieldIds());

List<Entry> entryList = userInfo.getListEntryObjects(formName, myQualifier, 0,
Constants.AR_NO_MAX_LIST_RETRIEVE, sortOrder, fieldIds, true, nMatches);

for (int i = 0; i < entryList.size(); i++) {

try {

Entry entry = userInfo.getEntry(formName, entryList.get(i).getEntryId(), null);

for(int ii=0;ii<fieldIds.length-1;ii++){
log.debug(ii +”.) Value” + (entry.get(fieldIds[ii]).getValue() != null ? entry.get(fieldIds[ii]).getValue().toString():”null”) + “”);
}

} catch (NullPointerException ex) {
log.debug(i + “.)” + ex.getLocalizedMessage());
}

}
//////////////////////////////////////////////////////////////////////////////
///End Query Records By Qualification/////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////