Using arrays in Sessions
Hi! Im setting some ints inside an array for further usage.
This is page1.jsp
<%
int[] page_IDS = {17,19,24,31,50};
session.setAttribute("sessPageIds",page_IDS);
%>
This is page2.jsp
<%
out.println(session.getAttribute("sessPageIds"));
%>The problem is that when user goes to page2.jsp, this is what gets printed:
*[I@9d77c2*
I would really need to sweep the original array on page2.jsp, something like:
<%
for(int j=0;j<session_array_name_here.length;j++){
//check some things with the value here
%>
How can i retrieve the original array values? Is there a way to use the session value as an array?
You did retrieve the original array there. But printing an array (which is what you did there) just calls its toString() value, which doesn't produce anything useful. You could write a loop that looked at each of the individual elements.
Some advice on JSP: scriptlets like that are obsolete. You should be using JSTL rather than just inserting clumps of Java code.
Similar Messages
-
Error using Arrays.toString()
Hi there,
I am getting the following error using Arrays.toString on a String Array. 'toString() in java.lang.Object cannot be applied to (java.lang.String[]).
The line in question is at the bottom of the below code. It starts 'rtitem.appendText.....
import lotus.domino.*;
//import java.util.Arrays;
public class JavaAgent extends AgentBase {
Database curDb;
String[] dbList;
public void NotesMain() {
int dbcount = 0;
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
//get current database
Database curDb = agentContext.getCurrentDatabase();
//build a list of servers;
String[] servers = {"Norwich002/Norwich/MoneyCentre","Norwich003/MoneyCentre","Norwich004/MoneyCentre","Norwich005/MoneyCentre","Norwich007/Norwich/MoneyCentre","Norwich008/Norwich/MoneyCentre","Norwich010/Norwich/MoneyCentre","Norwich020/Norwich/MoneyCentre","Norwich021/Norwich/MoneyCentre"};
//loop through server list
int arraylen = servers.length;
for(int i=0;i <= arraylen;i++){
//create a notesdbdirectory collection for the current server iteration
DbDirectory dbdir = session.getDbDirectory(servers);
//get first database
Database db = dbdir.getFirstDatabase(DbDirectory.DATABASE);
//loop through databases in dbdir
while (db != null){
//add database details to our list
dbList[dbcount] = db.getTitle() + " - " + db.getFilePath();
dbcount++;
} catch(Exception e) {
e.printStackTrace();
private boolean sendEmail(String subject){
try{
Document mailDoc = curDb.createDocument();
mailDoc.replaceItemValue("SendTo","Hayleigh S Mann/Norwich/MoneyCentre");
mailDoc.replaceItemValue("Subject",subject);
RichTextItem rtitem = mailDoc.createRichTextItem("Body");
rtitem.appendText(java.util.Arrays.toString(dbList));
mailDoc.send();
return true;
}catch(Exception e){
e.printStackTrace();
return false;No, that doesn't make any sense. Arrays.toString can take any array as an arg: [http://java.sun.com/javase/6/docs/api/java/util/Arrays.html#toString(java.lang.Object[])]
import java.util.*;
public class A {
public static void main(String[] args) {
String str = Arrays.toString(args);
System.out.println(str);
:; java -cp . A abc 123 xxx
[abc, 123, xxx] -
hi guys, i need your advice , is it safe to store array in session will it use up the webserver memory ? thanks a lot
hi,
session.setAttribute("attibuteName", Object);
you can put all u need in your sesion's attributes.
get them with:
if(session.getAttribute("attributeName")!=null) variable = (variableDataType) session.getAttribute("attributeName");
for example:
vector myVector = new Vector();
if(session.getAttribute("myVector")!=null) myVector = (Vector)session.getAttribute("myVector");
hope this helps
Message was edited by:
Tobi -
How can I use active user session that's in an application scope Hashtable?
First of all, is it possible to use the same session after a user exits and then returns?
Second, if it is possible, then please tell me what I need to do. So far, this is what I have been doing...
1.) The user submits login credentials
2.) The user is authenticated.
3.) The user does not have an existing session, so a new one is created.
4.) The user closes the browser.
5.) The user returns to login page and submits login credentials.
6.) The user is authenticated.
7.) The user has an existing session, so it should be used.
This is where I'm having trouble. All active sessions for my application are stored in a Hashtable. I have been using <%@ page session="false" %> so that a new session is not automatically created. Each time before I create a new session, I check my Hashtable to see if that user has an existing session. If a session exists for that user, then I would like to continue using that session if possible. I have used the methods request.getSession() and request.getSession(false), but a new session is always returned.
I could create a new session, copy the attributes from the old session(which is stored in my Hashtable) to the new session, and then invalidate the old session, but I'd rather not do that.
Is there a way that I can use existing sessions that I have stored in my Hashtable?First of all, is it possible to use the same session after a user exits and then returns?No, I don't think so. Let me explain why. When the server creates a session object for each client, it needs to know which client is making the request. Remember that HTTP is a stateless protocol. Every time a client makes a request, it sends some sort of session id to the server to let the server know who is trying to make the request. The server will then check to see if a session object exists for that particular client and if so, it will make sure that the max inactive interval (maximum time alloted for that client's session) has not been exceeded. If every thing is okay, then the client can access the session object to get values that were previously placed there. There are many ways that servers try to keep track of clients. One way is to have the clients write the session ID using cookies. But, many people like disallow cookies. So some servers do what is known as URL rewriting. That is, they will write the session ID on the end of the query string. This can also be accomplished programmatically, but it can be taxing to do. Anways, the point is that the client and the server have to have some sort of link between each other and that link is the session ID. So, if the browser is closed, the session ID is lost. That particular client will be forced to get a new session ID the next time the following code is executed:
//create a session object and set its values
HttpSession session = request.getSession(true);>
Second, if it is possible, then please tell me what I
need to do. So far, this is what I have been doing...
1.) The user submits login credentials
2.) The user is authenticated.
3.) The user does not have an existing session, so a
new one is created.
4.) The user closes the browser.
5.) The user returns to login page and submits login
credentials.
6.) The user is authenticated.
7.) The user has an existing session, so it should
be used.If you really want to do something like this, you could make up your own ID and store it as a cookie on the client. I've never tried anything like this before so you would have to do your own research. Are you sure you want to do something like this. There is a reason why it works the way it does. There is also a reason why you want to keep the session timeout value some what small. Let me give you an example of some craziness with sessions. A client we once had wanted to keep their sessions open for 4 hours because they said there clients simply did not like to log in all the time. I nearly gasped when I was told we needed to do this. When you make the session time out large (i.e. the maxInactiveInterval( )), then session objects stick around longer in the server. Let's say a client logs into the server and receives a session object. Then, the client makes a few requests. The server knows to keep the session alive as long as the time between requests has not exceeded 4 hours. Then the client closes the browser. How is the server suppose to know that the browser was closed. Well, it doesn't. It just knows to check times between requests. So, that particular session object won't be garbage collected until the session times out. What if a whole bunch of clients did this. Yucko. The server would have a whole bunch of session objects living in memory. What a waste. This is all above and beyond the typical security problems that can arise from having a session open for so long. To make a long story short, you really shouldn't do what you are trying to do unless it is the nature of the app.
>
This is where I'm having trouble. All active sessions
for my application are stored in a Hashtable. I have
been using <%@ page session="false" %> so that a new
session is not automatically created. Each time
before I create a new session, I check my Hashtable
to see if that user has an existing session. If a
session exists for that user, then I would like to
continue using that session if possible. I have used
the methods request.getSession() and
request.getSession(false), but a new session is
always returned.
I could create a new session, copy the attributes from
the old session(which is stored in my Hashtable) to
the new session, and then invalidate the old session,
but I'd rather not do that.
Is there a way that I can use existing sessions that I
have stored in my Hashtable? -
BDC programming using Batch input Session.
Hello Experts.
I'm an ABAP beginner. I've benn practicing BDC programming using Batch input Session
at the moment.
This is the program that upload Local file which has plural records, and put the records into a Session.
These are the records.
413459,KIM EI HWAN121 ,19810607,MIADONG1234
423459,KIM EI HWAN122 ,19810607,MIADONG1235
433459,KIM EI HWAN123 ,19810607,MIADONG1236
443459,KIM EI HWAN124 ,19810607,MIADONG1237
453459,KIM EI HWAN125 ,19810607,MIADONG1238
463459,KIM EI HWAN126 ,19810607,MIADONG1239
I succeeded making Session.
However, for some reaseon, every record in the Session has got the same, value which is the first record.
Why is this happening? And How can I correct the code below?
REPORT ZBCUSER002_BATCH NO STANDARD PAGE HEADING
LINE-SIZE 255
MESSAGE-ID ZBATCH.
= Types definition ===================================================
TYPES: BEGIN OF TYP_LOCAL, "For Local file upload
RECORD(200) TYPE C,
END OF TYP_LOCAL.
= Internal table definition ==============================================
DATA: BEGIN OF BDC_TAB OCCURS 0. "BDCDATA itab
INCLUDE STRUCTURE BDCDATA.
DATA: END OF BDC_TAB.
DATA: BEGIN OF MESSAGE_BDC OCCURS 0. "Message itab
INCLUDE STRUCTURE BDCMSGCOLL.
DATA: END OF MESSAGE_BDC.
DATA: TBL_LOCAL TYPE STANDARD TABLE OF TYP_LOCAL, "Local file itab
F_TBL TYPE FILETABLE. "FILETABLE fot local
= Structure table definition =========================================
DATA: STR_F_TBL LIKE LINE OF F_TBL, "FILETABLE structure
STR_LOCAL TYPE TYP_LOCAL. "Local file structure
= Variable definition ================================================
DATA: LV_RC TYPE I, "Method parameter
ENUMBER TYPE ZT601-ENUMBER, "Employee number
NAME TYPE ZT601-NAME, "Employee name
BIRTH TYPE ZT601-BIRTH, "Birthday
HOMETOWN TYPE ZT601-HOMETOWN, "Hometown
SYSVAL TYPE SY-SUBRC. "System valuible
= Constants definition ===============================================
CONSTANTS: TBL_NAME(10) TYPE C VALUE 'ZT601'. "Table name ZT601
= Parameters definition ==============================================
PARAMETERS: F_NAME TYPE RLGRAP-FILENAME OBLIGATORY, "File path
EXECMODE(1) TYPE C. "Execute mode
INITIALIZATION
*----- Initialize all valuables, structures and internal tables
CLEAR: LV_RC,
STR_F_TBL,
STR_LOCAL,
ENUMBER,
NAME,
BIRTH,
HOMETOWN.
REFRESH: F_TBL,
TBL_LOCAL.
AT SELECTION-SCREEN
*----- When the button next to Parameter 'F_NAME',
*----- File dialog open.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR F_NAME.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE = 'SELECT FILE'
DEFAULT_FILENAME = '*.TXT'
CHANGING
FILE_TABLE = F_TBL
RC = LV_RC
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
OTHERS = 3
*----- system valiable check.
*----- If done properly,
*----- Put the path into the File path parameter
IF SY-SUBRC = 0.
READ TABLE F_TBL INTO STR_F_TBL INDEX 1.
F_NAME = STR_F_TBL.
*----- If not done properly, show message
*----- An error occured while getting file path then end program
ELSE.
MESSAGE E000.
ENDIF.
*----- Execute code can only be A or N.
AT SELECTION-SCREEN ON EXECMODE.
IF EXECMODE <> 'A' AND EXECMODE <> 'N'.
MESSAGE E001.
ENDIF.
START-OF-SELECTION
START-OF-SELECTION.
*----- Upload Local file of file path parameter.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = F_NAME
FILETYPE = 'ASC'
TABLES
DATA_TAB = TBL_LOCAL
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
OTHERS = 6.
*----- System valiable check.
*----- If not done properly, show an error message
*----- An error occured while uploading local file then end program
IF SY-SUBRC <> 0.
MESSAGE E002.
ENDIF.
PERFORM BDC_OPEN.
*----- Loop Internal table
LOOP AT TBL_LOCAL INTO STR_LOCAL.
*----- Spilt the file record and put them into each valiable.
SPLIT STR_LOCAL AT ',' INTO ENUMBER
NAME
BIRTH
HOMETOWN.
*----- Data check Function module
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
DATE = BIRTH
EXCEPTIONS
PLAUSIBILITY_CHECK_FAILED = 1
OTHERS = 2.
*----- When error occurs while checking date, show an error message.
*----- (&1) is not date
IF SY-SUBRC <> 0.
MESSAGE E003 WITH BIRTH.
ENDIF.
*-- The first screen of SE11
*----- Screen number 0102 of program id SAPMSRD0
PERFORM BDC_DYNPRO USING 'SAPMSRD0' '0102'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RSRD1-TBMA_VAL'. "Field on Cursor
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=SHOW'. "Display button
PERFORM BDC_FIELD USING 'RSRD1-TBMA'
'X'.
PERFORM BDC_FIELD USING 'RSRD1-TBMA_VAL'
TBL_NAME. "ZT601
*-- Table definition screen
*----- Screen number 2000 of program id SAPLSD02
PERFORM BDC_DYNPRO USING 'SAPLSD02' '2000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'DD02D-TABCLTEXT'. "Field on Cursor
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=TDED'. "Create entry
PERFORM BDC_FIELD USING 'BDC_SUBSCR'
'SAPLSD02'.
PERFORM BDC_FIELD USING 'BDC_SUBSCR'
'SAPLSED5'.
*-- Data input screen
*----- Screen number 0101 of program /1BCDWB/DBZT601
PERFORM BDC_DYNPRO USING '/1BCDWB/DBZT601' '0101'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'ZT601-CRUSER'. "Field on Cursor
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=SAVE'. "Save
PERFORM BDC_FIELD USING 'ZT601-MANDT'
SY-MANDT. "Client
PERFORM BDC_FIELD USING 'ZT601-ENUMBER'
ENUMBER. "Employee number
PERFORM BDC_FIELD USING 'ZT601-NAME'
NAME. "Employee name
PERFORM BDC_FIELD USING 'ZT601-BIRTH'
BIRTH. "Birthday
PERFORM BDC_FIELD USING 'ZT601-HOMETOWN'
HOMETOWN. "Hometown
PERFORM BDC_FIELD USING 'ZT601-CRDATE'
SY-DATUM. "System date
PERFORM BDC_FIELD USING 'ZT601-CRTIME'
SY-UZEIT. "System time
PERFORM BDC_FIELD USING 'ZT601-CRUSER'
SY-UNAME. "System user
*-- Data input screen (After input)
*----- Screen number 0101 of program /1BCDWB/DBZT601
PERFORM BDC_DYNPRO USING '/1BCDWB/DBZT601' '0101'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/EBACK'. "Back
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'ZT601-CRUSER'. "Field on Cursor
*-- Table definition screen]
*----- Screen number 2000 of program SAPLSD02
PERFORM BDC_DYNPRO USING 'SAPLSD02' '2000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'DD02D-TABCLTEXT'. "Field on Cursor
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=WB_BACK'. "Back
*-- The first screen of SE11
*----- Screen number 0102 of program SAPMSRD0
PERFORM BDC_DYNPRO USING 'SAPMSRD0' '0102'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RSRD1-TBMA_VAL'. "Field on Cursor
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=BACK'.
PERFORM BDC_FIELD USING 'RSRD1-TBMA'
'X'.
PERFORM BDC_FIELD USING 'RSRD1-TBMA_VAL'
TBL_NAME.
PERFORM BDC_INSERT.
ENDLOOP.
PERFORM BDC_CLOSE.
FORM BDC_DYNPRO *
Put Program-Id, Dynpro screen number, Start point
into DBCDATA
--> PROGRAM *
--> DYNPRO *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDC_TAB.
BDC_TAB-PROGRAM = PROGRAM.
BDC_TAB-DYNPRO = DYNPRO.
BDC_TAB-DYNBEGIN = 'X'.
APPEND BDC_TAB.
ENDFORM.
FORM BDC_FIELD *
Put Field Name and Value into BDCDATA
--> FNAM *
--> FVAL *
FORM BDC_FIELD USING FNAM FVAL.
CLEAR BDC_TAB.
BDC_TAB-FNAM = FNAM.
BDC_TAB-FVAL = FVAL.
APPEND BDC_TAB.
ENDFORM.
FORM bdc_process *
FORM BDC_OPEN.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = 'Testsession'
KEEP = 'X'
USER = SY-UNAME.
IF SY-SUBRC <> 0.
MESSAGE E006 WITH SY-SUBRC.
ENDIF.
ENDFORM.
FORM bdc_insert *
FORM BDC_INSERT.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'SE11'
TABLES
DYNPROTAB = BDC_TAB
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 6
OTHERS = 7.
IF SY-SUBRC <> 0.
MESSAGE E007 WITH SY-SUBRC.
ENDIF.
CLEAR: BDC_TAB.
ENDFORM.
FORM bdc_close *
FORM BDC_CLOSE.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE E008 WITH SY-SUBRC.
ENDIF.
ENDFORM.God I forgot to refresh Internal table after putting record into Session.
Now I'm done.
You guys be careful too. -
HI all,
I am working on a program that will print out my initials 'A' and 'T' using arrays. I am asked to initialize the first intial to '*' and the second intial to '@'. I wrote the code but the output is wrong. Can someone help me by letting me know what I am doing wrong in my arrray?I just get back my array of 30X30. I also wrote a driver but when I run the program, I really appreciate it so much.
public class Initial
private char whichinitial ;
private int MAX =30;//Maximum amount for 2-d Matrix
char[][] letterMatrix = new char[MAX][MAX];//2-d Array 30 x30
private boolean first = true;
public Initial()
{ //FIlls Array full of '*'s
whichinitial = '*';
for(int i=0;i< MAX;i++)
for(int j=0;i< MAX;i++)
letterMatrix[i][j] = whichinitial;
public void setLetter(char letter)
{//Setter for Letter
whichinitial = letter;
public char getLetter()
{//Getter for Letter
return whichinitial;
public void firstLetter()
{ //Creates an A shape
for(int i=0;i< MAX;i++)
for(int j=0;j< MAX;j++)
if((i>0)|| ((i<6) || ((j>0) && (j<29))))
letterMatrix[j] =whichinitial;
public void secondLetter()
{//Creates an T shape
first = false;
for(int i=0;i <MAX;i++)
for(int j=0;j <MAX;j++)
if((i>1) ||(j < 29)||(j>5)||(i>10))
letterMatrix[i][j] = whichinitial;
public void display()
{//Displays the Initials
if(first)
System.out.println("\n \n \n My First Initial," + whichinitial + ", follows:");
else
System.out.println("\n \n \n My Last Initial," + whichinitial + ", follows:");
for(int i=0;i <MAX;i++)
System.out.println();
for(int j=0;j <MAX;j++)
if(letterMatrix[i][j] == '*')
System.out.print(" ");
else
System.out.print(letterMatrix[i][j]);I am trying to write a program using a matrix. The size of the maxtrix should be 30X30. The first initial shoulld be initialized to '*' and the secind initial should be initialized to '@'. Both initials should be 30 characters high and 30 characters wide and the initials should also represent the uppercase letter of your initials. I know that the first initial's matrix needs to be filled up vertically and the second initial needs to be filled horizontally but the output is wrong....PLease Help!
Message was edited by:
apples03 -
Hi guys,
I'm developing an ADF application in JDev 11.1.1.6.0. I have problem about using arrays in jsp page. I have an iterator that brings me data from UCM. I just want to take every documents seperately and use in a Jquery division by division.
Can i have chance to use an array tag in that page? Or how can i make it possible my work in a different way?
Thank you so much,
ErdoHi Frank,
I've already use an iterator. I just want to take datas and after close the af:iterator tag. Then i will use those datas in a different block.
My code :
<af:iterator var="node" value="#{nodes}" id="i1">
<af:outputText value="#{node.propertyMap['CSGMNEWS_REGDEF:Desc'].asTextHtml}"
id="ot1"/>
</af:iterator>
I want to take all informations from node.PropertyMap[] and then i will set the values of outputText with those informations. I hope I'm clear.
Regards,
Erdo
Edited by: erdo on 20.Mar.2013 10:21 -
Hi Every one,
An error has occurred during report processing. (rsProcessingAborted)
Get Online Help
Query execution failed for data set 'NonFinTran'. (rsErrorExecutingCommand)
Get Online Help
Cannot drop the table '#NonFinTran', because it does not exist in the system catalog. Cannot drop the table '#MultipleNonFinTran',
because it does not exist in the system catalog. Transaction context in use by another session.
NOTE: NonFinTran &
MultipleNonFinTran are
the Temp table in my storedPoc.
Please any help me to solve this issue.
Thanks & Regards,
Anil Kumar
Anil KumarHi Harsh,
Below is my Stored Proc
SELECT @ServerName=datasource from master.dbo.sysservers WHERE catalog='Voyager'
SELECT @ServerName3=datasource from master.dbo.sysservers WHERE catalog='AuditLog'
SELECT @ServerName2=datasource from master.dbo.sysservers WHERE catalog='Portal'
IF @ServerName IS NOT NULL SET @ServerName='[' + @ServerName + '].' ELSE SET @ServerName=''
IF @ServerName3 IS NOT NULL SET @ServerName3='[' + @ServerName3 + '].' ELSE SET @ServerName3=''
IF @ServerName2 IS NOT NULL SET @ServerName2='[' + @ServerName2 + '].' ELSE SET @ServerName2=''
IF Exists(Select * From tempdb.dbo.SysObjects Where Name Like '#NonFinTran%')
DROP TABLE #NonFinTran
IF Exists(Select * From tempdb.dbo.SysObjects Where Name Like '#MultipleNonFinTran%')
DROP TABLE #MultipleNonFinTran
CREATE TABLE #NonFinTran (FirstName VARCHAR(40), TaxId VARCHAR(40), TrxID VARCHAR(40), Status VARCHAR(255), Field1 VARCHAR(255), Field2 VARCHAR(255),
Field3 VARCHAR(255), Field4 VARCHAR(255), Field5 VARCHAR(255), Field6 VARCHAR(255), DateTime DATETIME,
BranchID CHAR(3), BankID CHAR(1), FromAccountID VARCHAR(255), FromAccountType VARCHAR(255))
CREATE TABLE #MultipleNonFinTran (FirstName VARCHAR(40), TaxId VARCHAR(40), TrxID VARCHAR(40), Status VARCHAR(255), Field1 VARCHAR(255), Field2 VARCHAR(255),
Field3 VARCHAR(255), Field4 VARCHAR(255), Field5 VARCHAR(255), Field6 VARCHAR(255), DateTime DATETIME,
BranchID CHAR(3), BankID CHAR(1), FromAccountID VARCHAR(255), FromAccountType VARCHAR(255))
INSERT #NonFinTran
EXEC('SELECT FirstName, TaxID,
TrxID, Status, TrxField1, TrxField2, TrxField3, TrxField4, TrxField5, TrxField6, DateTime, '''', '''', '''', ''''
FROM ' + @ServerName3 + 'AuditLog.dbo.CCAuditLogEntryView AS Audit, ' + @ServerName + 'Voyager.dbo.CCUser AS CCUser
WHERE CCUser.UserID = Audit.UserID
AND Audit.Succeeded = 1
AND Audit.TrxID IN (''ChangeBillPayDefaultAccountEdit'',''ChangeExpiryUserPassword'',''ChangePasswordEdit'',
''ChangeUserPassword'',''ManageAddressMaint'',''ManageContactMaint'',''ManageSecretQuestionAnswerEdit'',
''ManageTransLimitMaint'',''OtherBankAccountMaintAdd'',''OtherBankAccountMaintDelete'',''OtherBankAccountMaintEdit'',
''WithinAmBankAccountMaintAdd'',''WithinAmBankAccountMaintDelete'',''WithinAmBankAccountMaintEdit'',
''SetAccountMaskPreferenceAudit'',''ChangeLoginIdAudit'')
AND DATEDIFF(DAY, CONVERT(DATETIME, CONVERT(VARCHAR(10), ''' + @StartDate + '''), 103), Audit.DateTime) >= 0
AND DATEDIFF(DAY, CONVERT(DATETIME, CONVERT(VARCHAR(10), ''' + @EndDate + '''), 103), Audit.DateTime) <= 0 ')
INSERT #MultipleNonFinTran
EXEC('SELECT DISTINCT FirstName, TaxID,
TrxID, Status, TrxField1, TrxField2, TrxField3, TrxField4, TrxField5, TrxField6, Audit.DateTime as AuditDateTime,
(SELECT DISTINCT SUBSTRING(A.BranchCode,3,3) FROM ' + @ServerName + 'AuditLog.dbo.CCAuditLogEntryView X INNER JOIN ' + @ServerName + 'Voyager.dbo.CCuser U
ON X.UserId = U.UserId INNER JOIN ' + @ServerName + 'Voyager.dbo.AMHZ_CustomerProfile P ON P.EnrolId = U.TAXID
INNER JOIN ' + @ServerName + 'Voyager.dbo.AMHZ_AccountListing A ON A.CIFNO = P.CIFNO
WHERE X.UserId = Audit.UserId AND A.AccountNo = SUBSTRING(Audit.TrxField1,11,16) AND P.CIFNO = A.CIFNO
AND (SUBSTRING(A.BranchCode,3,3) <> NULL OR SUBSTRING(A.BranchCode,3,3) <> '''')
AND CHARINDEX(''AccountID='', Audit.TrxField1, 1) > 0),
SUBSTRING(TrxField1,14,1), CASE WHEN CHARINDEX(''AccountID='', TrxField1, 1) > 0 THEN
SUBSTRING(TrxField1,11,16) ELSE '''' END, CASE WHEN CHARINDEX(''AccountType='', TrxField2, 1) > 0 THEN SUBSTRING(TrxField2,13,3) ELSE '''' END
FROM ' + @ServerName3 + 'AuditLog.dbo.CCAuditLogEntryView AS Audit, ' + @ServerName + 'Voyager.dbo.CCUser AS CCUser
WHERE CCUser.UserID = Audit.UserID
AND Audit.Succeeded = 1
AND Audit.TrxID IN (''SetAccountAttributesAudit'',''SetAccountFriendlyNameAudit'',
''AccountProfileMaintULDelete'',''AccountProfileMaintLHAAdd'',''AccountProfileMaintLSCAdd'')
AND DATEDIFF(DAY, CONVERT(DATETIME, CONVERT(VARCHAR(10), ''' + @StartDate + '''), 103), Audit.DateTime) >= 0
AND DATEDIFF(DAY, CONVERT(DATETIME, CONVERT(VARCHAR(10), ''' + @EndDate + '''), 103), Audit.DateTime) <= 0 ')
SET @stmt = '
SELECT * FROM
SELECT BranchName,
CASE WHEN SUBSTRING(FromAccountID,1,6) IN (''519901'',''559409'') THEN ''DC''
ELSE
CASE FromAccountType WHEN ''01'' THEN ''SA '' WHEN ''02'' THEN ''CA '' WHEN ''03'' THEN ''FD ''
WHEN ''SA'' THEN ''SA '' WHEN ''CA'' THEN ''CA '' WHEN ''FD'' THEN ''FD '' ELSE FromAccountType + '' ''
END
END +
case when Len(FromAccountID) =16 Then
CASE FromAccountType WHEN ''VC'' THEN
SUBSTRING(FromAccountID,1,6)+''******''+SUBSTRING(FromAccountID,13,4)
WHEN ''MC'' THEN SUBSTRING(FromAccountID,1,6)+''******''+SUBSTRING(FromAccountID,13,4) END
when Len(FromAccountID) =15 Then
CASE FromAccountType WHEN ''VC'' THEN
SUBSTRING(FromAccountID,1,6)+''******''+SUBSTRING(FromAccountID,13,3)
WHEN ''MC'' THEN SUBSTRING(FromAccountID,1,6)+''******''+SUBSTRING(FromAccountID,13,3) END
ELSE FromAccountID
ENd
AS FromAcctNo,
CASE TrxId
WHEN ''AccountProfileMaintLHAAdd'' THEN ''Link Account/Card''
WHEN ''AccountProfileMaintLSCAdd'' THEN ''Link Account/Card''
WHEN ''APMFamilyFirstAdd'' THEN ''Link Family First Account''
WHEN ''AccountProfileMaintULDelete'' THEN ''Unlink Account/Card''
WHEN ''BalInqFD'' THEN CASE WHEN Field3 IN (''APMLink=SUCCESS'') THEN ''APMLink Success'' ELSE ''Fixed Deposit Balance Inquiry'' END
WHEN ''BalInqCASA'' THEN CASE WHEN Field3 IN (''APMLink=SUCCESS'') THEN ''APMLink Success'' ELSE
CASE WHEN FromAccountType IN (''SA'',''01'') THEN ''Savings Account Balance Inquiry''
ELSE ''Current Account Balance Inquiry''
END
END
WHEN ''StopCheck'' THEN ''Stop Cheque Request''
WHEN ''CheckReorder'' THEN ''Order Your Cheque''
WHEN ''CheckInquiry'' THEN ''Cheque Inquiry''
WHEN ''TransHistFD'' THEN ''Fixed Deposit Transaction History''
WHEN ''TransHistCASA'' THEN
CASE WHEN FromAccountType IN (''SA'',''01'') THEN ''Savings Account Transaction History'' ELSE ''Current Account Transaction History'' END
WHEN ''StmtInqCC'' THEN
CASE WHEN FromAccountType IN (''DR'',''03'') THEN ''Debit Card Statement Inquiry'' ELSE ''Credit Card Statement Inquiry'' END
WHEN ''StmtInqDA'' THEN
CASE WHEN FromAccountType IN (''SA'',''01'') THEN ''Savings Account Statement Inquiry'' ELSE ''Current Account Statement Inquiry'' END
WHEN ''StmtReq'' THEN ''Printed Statement Request''
WHEN ''StmtInqIAMSTAR'' THEN ''E-AMSTAR Statement Inquiry''
WHEN ''Repayment/Transfer Inquiry'' THEN ''Repayment/Transfer Inquiry''
WHEN ''Account Inquiry'' THEN ''Account Inquiry''
WHEN ''Payment Inquiry'' THEN ''Payment Inquiry''
END AS TransType,
FirstName AS CustomerName,
TaxId, CONVERT(VARCHAR, DateTime, 103) AS Date, CONVERT(VARCHAR, DateTime, 108) AS Time
FROM #NonFinTran, ' + @ServerName3 + 'Portal.dbo.TB_Branch AS TB_Branch
WHERE
BranchId = TB_Branch.BranchCode
AND (TB_Branch.InstCode IN (''00001'', ''00003'',''001'',''002''))
AND (FromAccountType IN (''SA'', ''CA'', ''FD'', ''01'', ''02'', ''03'')))'
EXEC (@stmt)
IF Exists(Select * From tempdb.dbo.SysObjects Where Name Like '#NonFinTran%')
DROP TABLE #NonFinTran
IF Exists(Select * From tempdb.dbo.SysObjects Where Name Like '#MultipleNonFinTran%')
DROP TABLE #MultipleNonFinTran
Anil Kumar -
hi i want to know if some can guide me how to use array in apex.
i have a tabuler report with 4 columns.
i need to write a validation in the tabuler report for that i need to used array.
can I directly access the colums as i have shown below? or do i need to decleare this arrays some were in apex?
e.g
FOR i IN 1 .. ow_app.g_f01.COUNT
loop.........................
LOGIC
end loop;
from what i understand i can access each column as ow_app.g_f01,ow_app.g_f02,ow_app.g_f03,ow_app.g_f04 does this make sense?
thanks a lot.Hi user591315 (please tell us your name - we're a friendly group!),
In answer to this and your previous related post, there is an excellent example of what you're looking to accomplish provided by Denes Kubicek available at http://apex.oracle.com/pls/otn/f?p=31517:41
Hope this helps,
John
If you find this information useful, please remember to mark the post "helpful" or "correct" so that others may benefit as well. -
First, I would like to thank everyone in this forum for all the help they have given me over the past few weeks. With that said, I am currently trying to alter the following code to accept and use arrays to end to produce three seperate results. The program now as three hard coded variables which are
Amount = 200000.00;
Term = 30;
InterestRate = .0575;
I need to have the program work the same, but produce results for three different Terms and Three different periods. Below is the code the I am working on, I have added two arrays containing the required information. I am having a hard time coming up with a for statment to move the program through the two arrays. Any pushes in the right direction would be great. I left the hard code variable in place, I know that I do need to remove them and alter the equations. I just thought it would be easier for everyone to understand if I left the code in working form.
import java.math.*;
import java.text.*;
import java.util.*;
// The Payment class displays a predetermined monthly mortgage payment
public class Payment
public static void main(String[]arguments)
//Creates Two Arrays for InterestRates and Terms
double[] InterestRates = {.0535, .055, .0575};
int[] Terms = {7, 15, 30};
//Creates variables
double Amount;
int Term;
double InterestRate;
//Assigns values to variables
Amount = 200000.00;
Term = 30;
InterestRate = .0575;
//Alters the display format of Amount variable
NumberFormat n = NumberFormat.getCurrencyInstance(Locale.US);
String s = n.format(Amount);
//Creates variables
double MonthlyInterestRate;
int TotalMonths;
double Payment;
//Assigns values to variables
MonthlyInterestRate = InterestRate / 12;
TotalMonths = Term * 12;
Payment = Amount* MonthlyInterestRate / (1-(Math.pow((1+MonthlyInterestRate ),(-TotalMonths))));
//Takes Payment variable and round answer to 2 decimal points
BigDecimal bd = new BigDecimal(Payment);
bd = bd.setScale(2, BigDecimal.ROUND_DOWN);
//Instructions to display various varibles
System.out.println("Cost of Mortgage "+ s);
System.out.println("Length of Term " + Term);
System.out.println("Interest Rate 5.75% ");
System.out.println("The monthly payment of this loan is $" + bd);
System.out.println();
//Creates new set of variables
double MonthlyInterest;
double MonthlyPrincipal;
double TotalInterestPaid;
int NumberofPayments;
//Creates Balance variable
double Balance;
//Initialization of Balance variable
Balance = 200000;
TotalInterestPaid = 0;
NumberofPayments = 360;
//Creates a loop that calculates the entire term of loan
do
MonthlyInterest = Balance * (InterestRate / 12);
MonthlyPrincipal = Payment - MonthlyInterest;
Balance = Balance - MonthlyPrincipal;
TotalInterestPaid = TotalInterestPaid + MonthlyInterest;
NumberofPayments = NumberofPayments - 1;
//Takes current balance and rounds the answer to two digits
BigDecimal bb = new BigDecimal(Balance);
bb = bb.setScale(2, BigDecimal.ROUND_DOWN);
BigDecimal tip = new BigDecimal(TotalInterestPaid);
tip = tip.setScale(2, BigDecimal.ROUND_UP);
System.out.println("New Loan Balance " + bb);
System.out.println();
System.out.println("Total Interest Paid " + tip);
System.out.println();
System.out.println("Number of Payments remaining " + NumberofPayments);
System.out.println();
//The following lines of code pauses the loop to allow the user to read the output
//The speed of th display can be adujusted to a wide variety of speeds
try
Thread.sleep(400);
catch (InterruptedException exc)
//Loop condition
while (NumberofPayments > 0);
//Ends ApplicationTry this. It should give you some ideas. :)
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.util.Locale;
// The Payment class displays a predetermined monthly mortgage payment
public class Payment {
public static final NumberFormat CURRENCY_FORMAT = NumberFormat.getCurrencyInstance(Locale.US);
public static final double[] INTEREST_RATES = {.0535D, .055D, .0575D};
public static final int[] TERMS = {7, 15, 30};
public static final double AMOUNT = 200000.00;
public static final int MONTHS_PER_YEAR = 12;
public static void main(String[] arguments) {
for (int t = 0; t < TERMS.length; t++) {
for (int i = 0; i < INTEREST_RATES.length; i++) {
displayPayments(AMOUNT, INTEREST_RATES, TERMS[t]);
private static void displayPayments(double amount, double interestRate, int term) {
//Creates variables
//Assigns values to variables
double monthlyInterestRate = interestRate / MONTHS_PER_YEAR;
int totalMonths = term * MONTHS_PER_YEAR;
double payment = amount * monthlyInterestRate / (1 - Math.pow(1 + monthlyInterestRate, -totalMonths));
//Instructions to display various varibles
System.out.println("Cost of Mortgage " + CURRENCY_FORMAT.format(amount));
System.out.println("Length of Term " + term);
System.out.println("Interest Rate " + new BigDecimal(interestRate * 100).setScale(2, BigDecimal.ROUND_HALF_UP) + '%');
System.out.println("The monthly payment of this loan is " + CURRENCY_FORMAT.format(payment));
System.out.println();
//Creates new set of variables
double totalInterestPaid = 0.0D;
//Creates balance variable, Initialization of balance variable
double balance = amount;
//Creates a loop that calculates the entire term of loan
System.out.println("New Loan balance, Total Interest Paid, Number of Payments remaining");
for (int numberofPayment = totalMonths; numberofPayment > 0; numberofPayment--) {
double monthlyInterest = balance * monthlyInterestRate;
double monthlyPrincipal = payment - monthlyInterest;
balance -= monthlyPrincipal;
totalInterestPaid += monthlyInterest;
//Takes current balance and rounds the answer to two digits
BigDecimal bb = new BigDecimal(balance);
bb = bb.setScale(2, BigDecimal.ROUND_DOWN);
BigDecimal tip = new BigDecimal(totalInterestPaid);
tip = tip.setScale(2, BigDecimal.ROUND_UP);
System.out.println(CURRENCY_FORMAT.format(bb.doubleValue()) + ", " +
CURRENCY_FORMAT.format(tip.doubleValue()) + ", " +
numberofPayment);
System.out.println();
//Ends Application -
Hi All!
Anybody know how to use Arrays in Forms 6?
Best regards.Hello,
have you tried collections ?
Declare
TYPE TYP_NUM_ARRAY IS TABLE OF NUMBER INDEX BY BINARY_INTEGER ;
mytab TYP_NUM_ARRAY ;
Begin
For i IN 1..10 Loop
mytab(i) := i ;
End loop ;
End ;Francois -
Hi Guys,
I always had a few problems using arrays and now I need to use them and I am stuck.
on my program i need to create an array of int with the numbers 1 to 1000 in it for this I have done:
int[ ] array;
on the class constructor
array = new int[1000];
to fill the array:
for (int i = 0; i < array.length; i++)
array[i] = i;
The problem is that I always get an ArrayIndexOutOfBoundsException error.
I know how to solve it which is to create an array with 1001 elements but is there a more elegant way of creating the array or this is the way to do it?
To put my question in another way if any of you Guys was creating this program which way would you do it.
Best regards
LuisSloppy of me. This is a bit better:
package cruft;
import java.util.Arrays;
* A class for a one-based array of ints.
public class OneBasedIntArray
private int [] values;
public static void main(String[] args)
int [] values = new int[args.length];
for (int i = 0; i < args.length; i++)
values[i] = Integer.parseInt(args);
OneBasedIntArray intArray = new OneBasedIntArray(values);
System.out.println(intArray);
public OneBasedIntArray(int[] values)
this.values = new int[values.length];
System.arraycopy(values, 0, this.values, 0, values.length);
public int getValue(int index)
if (index <= 0)
throw new IllegalArgumentException("this array is one-based");
return values[index-1];
public void setValue(int index, int value)
if (index <= 0)
throw new IllegalArgumentException("this array is one-based");
this.values[index-1] = value;
public boolean equals(Object o)
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
OneBasedIntArray intArray = (OneBasedIntArray) o;
if (!Arrays.equals(values, intArray.values))
return false;
return true;
public int hashCode()
return (values != null ? Arrays.hashCode(values) : 0);
public String toString()
StringBuilder builder = new StringBuilder();
builder.append("OneBasedIntArray{");
for (int i = 0; i < values.length; i++)
builder.append("(").append(i+1).append(",").append(values[i]).append(")");
builder.append('}');
return builder.toString(); -
Using Arrays in SELECT BULK queries
Dear All,
Can we use arrays in the SELECT Bulk operations.
Example:
SELECT empno BULK COLLECT INTO v_empno FROM EMP WHERE deptno = v_deptno(m);
Is there any way we can simulate this example.
Appreciate your response on this one.
Thanks,
Madhu K.Yes you can. See the example.
SQL> set serverout on
SQL> declare
2 TYPE varr_typ IS VARRAY(2) OF NUMBER;
3 my_varr varr_typ:=varr_typ(20) ;
4 TYPE rec_typ IS RECORD (fname EMPLOYEES.First_Name%TYPE,
5 lname EMPLOYEES.LAST_NAME%TYPE);
6 TYPE tmp_tbl IS TABLE OF rec_typ;
7 my_tbl tmp_tbl;
8 BEGIN
9 --my_varr(1):=20;
10 SELECT FIRST_NAME,LAST_NAME
11 BULK COLLECT INTO my_tbl
12 FROM EMPLOYEES
13 WHERE department_id=my_varr(1);
14
15 FOR i IN 1..my_tbl.COUNT LOOP
16 DBMS_OUTPUT.put_line(my_tbl(i).fname||' '||my_tbl(i).lname);
17 END LOOP;
18 END;
19 /
Michael Hartstein
Pat Fay
PL/SQL procedure successfully completed. -
Question
How do you get firefox 4 to save tabs and windows and restore them? Don't say set preferences to open them on startup or use restore previous session under history; those do not work. Or is it no longer possible to save windows and tabs?'''IT'S A EASY AS IT SHOULD BE.'''
This is essentially paulbruster's answer, but I've added the steps some might assume, but which aren't so obvious to those of us who are new at this, like me.
This solution might ''appear'' to be long and complicated, but after you follow the directions once, you'll find it's quick, clean, and simple. Almost like they designed it this way.
# If you haven't already, open a bunch of tabs on a few different subjects.
# Click the List All Tabs button on the right side of the tab strip.
# Select Tab Groups.
# Create a few groups as described [http://support.mozilla.com/en-US/kb/what-are-tab-groups#w_how-do-i-create-a-tab-group here] , i.e. just drag them out of the main thumbnail group into the new groups they create.
# Now click on any thumbnail in any new group, but not the original big default group you may have left some tabs in.
#A regular Firefox window will open, but'' only the tabs in that group will be visible.'' You also now have the Tab Groups button in the tab strip.
# Right click on any tab, and there it is: Bookmark All Tabs. Click on it in the list of options. Or you can hit Ctrl+Shift+D instead and go straight to the dialogue box from the tab without any clicks. But don't go looking for this familiar option anywhere else, 'cause it's not there.
# Now pick an existing folder or create a new one just like you would have before and '''shlpam!''' there they are. New folders are supposed to end up in the Unsorted category all the way at the very bottom, but for some reason mine show up at the bottom of my last sorted category.
# DO NOT CLICK THE UPPER-RIGHTMOST X to close this group of tabs. This will close ALL of your tabs in all groups, currently visible or not. At least it asks if you're sure first. Instead, click your new Tab Groups button to return to the Boxes 'O Thumbnails window, and click the X in the group box you just bookmarked.
# Click on another thumbnail to repeat the process with another group, or click on a thumbnail in the big default box to return to the original FF window. You can also click the Tab Groups button at the upper right, or Ctrl+Shift+E, which will also get you ''into'' the Boxes 'O Nails window ''from'' FF.
# So now when you reopen FF after shutdown, simply select your folder from your Bookmarks and Open All in Tabs. '''Just like paulbruster said. ''' -
Explain the situation for using ale , bapi ,session ,call transation, di
what is the use of bdcmsgcall,
if any erroe occur in the legacy records how to rectify it?
In what situation we can go for lsmw.
Kindly explain the situation's for using ale , bapi ,session ,call transation, direct input.Hi ashok,
chk this.
the functionality of both idoc and bapi are same.
the main difference in BAPI is it is used for Third party application like JAVA, VB etc.
and IDOC is used transfer data from the SAP to sap or non-sap system.
For details refer the contents below
ALE
ALE is SAP proprietary technology that enables data communications between two or more SAP R/3 systems and/or R/3 and external systems. When a new enterprise resource planning (ERP) solution such as R/3 is implemented, companies have to interface the ERP system with legacy systems or other ERP systems.
ALE provides intelligent mechanisms where by clients can achieve integration as well as distribution of applications and data.
ALE technology facilitates rapid application prototyping and application interface development, thus reducing implementation time.
The ALE components are inherently integrated with SAP applications and are robust, leading to a highly reliable system.
ALE comes with application distribution/integration scenarios as well as a set of tools, programs, data definitions, and methodologies that you can easily configure to get an interface up and running.
BAPI
BAPIs provide a stable, standardized method for third-party applications and components to integrate into the Business Framework. These interfaces are being specified as part of SAP's initiative with customers, partners and leading standards organizations. Also, SAP has implemented the emerging Object Application Group (OAG) specifications with BAPIs.
Session method.
1) synchronous processing.
2) can tranfer large amount of data.
3) processing is slower.
4) error log is created
5) data is not updated until session is processed.
Call transaction.
1) asynchronous processing
2) can transfer small amount of data
3) processing is faster.
4) errors need to be handled explicitly
5) data is updated automatically
Session method is to populate the data by filling BDC structure
and keep as session to process from SM37 to post in appropriate Transaction.
Call transaction method is to post the data directly into the Transaction from an Executable program.
Session method SAP defined Function modules.
U can see more help on the differences in the SAP help.
hope u got an idea.
rgds
anver
<i>if hlped pls mark points</i>
Maybe you are looking for
-
HI SAP GURUS, Movement types used in these activities and also STO ( PLANT TO DEPO), (DEPO TO PLANT ) WIT AND WITHIN 1 COMPANY CODES AT PGI AT BILLING AT RETURNS all possible ways OR any short cuts points are to be rewarded for best relevent answe
-
How to show relation attribute on logical model
Hi. How to show child entity relation attributes on logical model? Entity properties attribute list contains relation attributes, LM dont show they. I have model with several subviews. I need to show some entity without related entities but need to s
-
I am adding a page # footer to a document with Portrait & Landscape pages and I want the footer to appear at the lower right corner of the short side of the page for all pages, regardless of page orientation. How do I do this? I'm working in Adobe
-
Hi..., I had an old R/3 system on top of SQL/NT (A) and another SQL/NT server (B) is used to VB application. Now, R/3 system (A) is migrated to Oracle/UNIX (C). I have a lot of interface programs from R/3 on SQL/NT (A) to another SQL/NT server (B). C
-
VM live migration during OVM server upgrade
Hi Guys, I'm planning to upgrade OVM 3.1.1 to 3.2.7. There are 4 OVM Servers in server pool and all is using the same CPU family which means the live migration is possible. I just wondering if I upgrade one OVM server to 3.2.7 first and then is it st