× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



An Enum is a class. Problem is, they are generally defined as inner classes. However, DataConsolidateFunction appears to be defined on its own. So you could try something like this for definitions and prototypes:

dcl-c DATACONSOLIDATIONFUNCTION_CLASS 'org.apache.poi.usermodel.DataConsolidationFunction';
dcl-c XSSF_PIVOTTABLE_CLASS 'org.apache.poi.xssf.usermodel.XSSFPivotTable';

dcl-s DataConsolidationFunction Object(*JAVA: DATACONSOLIDATIONFUNCTION_CLASS);
dcl-s XSSFPivotTable Object(*JAVA: XSSF_PIVOTTABLE_CLASS);

dcl-pr dataConsolidationFunction_valueOf
Like(DataDonsolidationFunction)
ExtProc(*JAVA:
DATACONSOLIDATIONFUNCTION_CLASS:
'valueOf');
Static;
string Like(jString) const;
end-pr;

dcl-pr xssfPivotTable_addColumnLabel
ExtProc(*JAVA:
XSSFPivotTable:
'addColumnLabel');
dcf Like(DataConsolidationFunction) const;
index Like(jint) value;
end-pr;

Then to call addColumnLabel you could do something like this (totally untested though):

dcl-s pt Like(XSSFPivotTable);
dcl-s dcf Like(DataConsolidationFunction);

dcf = dataCobnsolidationFunction_valueOf(new_String('SUM'));
xssfPivotTable_addColumnLabel(pt: dcf: 2);

Notice that this just adds a label to an existing XSSFPivotTable object. I have not created an instance of XSSFPivotTable. Also, I am guessing that Enums behave like classes, and can be defined to RPG as such. That might not be the case. If it doesn't work, then you might have to create a wrapper in Java that can take an integer or string constant instead of the enum, converts the constant to the appropriate enum, and then calls addColumnLabel. I believe that this is the only option when the enum is defined inside a class.


Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx


-----Darren Strong <darren@xxxxxxxxx> wrote: -----
To: "midrange-RPG RPG message board" <rpg400-l@xxxxxxxxxxxx>
From: Darren Strong <darren@xxxxxxxxx>
Date: 04/01/2016 08:37AM
Subject: How do you work with ENUM java fields in RPG-JNI interface?


I'm trying to do something like the following in RPG to create a pivot
table. The DataConsolidateFunction say that its supposed to return an ENUM
value. How do you work with that in RPG?


java example:
pivotTable.addColumnLabel(DataConsolidateFunction.SUM,2)

RPG equivalent that I have so far, but I realize is not correct:
DCL-PR addColumnLabel EXTPROC(*JAVA :
'org.apache.poi.xssf.usermodel+
.XSSFPivotTable' : 'addColumnLabel' );
arg0 OBJECT(*JAVA
: 'org.apache.poi.ss.usermodel.DataConsolidateFunction' );
arg1 INT(10) VALUE;
END-PR ;
callp addColumnLabel(PivotTable :
DataConsolidateFuntion.Sum : 2)



This from the POI javadoc:
java.lang.Enum<DataConsolidateFunction>
org.apache.poi.ss.usermodel.DataConsolidateFunction



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.