cancel
Showing results for 
Search instead for 
Did you mean: 

Populating multiple Input Field SVS help to same ValueSet of data

Former Member
0 Kudos

I am pulling in data from a custom table to populate 10 drop downs of users' names and email addresses.

Is there a faster/easier way to do this than to loop through my data and do a ValueSet.put 10 times (each into a seperate ValueSet)? Can I do the ValueSet.put once and then link the other 9 to the values of that same ValueSet? It is taking forever for my application to get through the WdDoInit phase and when I comment out all of this activity it is much faster.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Dana,

Seems that you are fetching data from "custom table" 10 times -- this is the only thing that slows down your application.

Just fetch data once into HashMap and then use this hash map later to populate SVS-s

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Former Member
0 Kudos

I tried to do the Hashmap by creating a new Hashmap, doing a single "put" in the loop where I pull in the data from JDBC and then iterating through that to populate the 10 valueset structures and it was still quite slow. In fact my entire application (totalling when the user clicks on a button to tally a row, committing data to the database) slows down extremely when I populate all 10 of these things. If I only populate 1 or 2 I get great performance all around. Here is a copy of the code. I am calling this method in wdDoInit. If there is nothing else that can be done to optimize this particular code would there be a better way to do this logic so that it doesn't slow the start and the processing of the application? It's an online approval process so I need to load up all relevant portal users in the dropdowns which I load into the custom table each evening so that I am not going after the UME data which was even slower than this was- just looking for any possible speed-ups that may be available...

On the database side I created an index on just the 3 fields in the query in this method and I also set the table for full buffering. Any other ideas on the DB side I can try would also be welcomed.

//@@begin javadoc:LoadApproverDropDowns()

/** Declared method. */

//@@end

public void LoadApproverDropDowns( )

{

//@@begin LoadApproverDropDowns()

IWDNodeInfo selValsNodeInfo = wdContext.nodeApprovals().getNodeInfo();

IWDAttributeInfo attrInfo1 = selValsNodeInfo.getAttribute("Approver1");

IWDAttributeInfo attrInfo2 = selValsNodeInfo.getAttribute("Approver2");

IWDAttributeInfo attrInfo3 = selValsNodeInfo.getAttribute("Approver3");

IWDAttributeInfo attrInfo4 = selValsNodeInfo.getAttribute("Approver4");

IWDAttributeInfo attrInfo5 = selValsNodeInfo.getAttribute("Approver5");

IWDAttributeInfo attrInfo6 = selValsNodeInfo.getAttribute("Approver6");

IWDAttributeInfo attrInfo7 = selValsNodeInfo.getAttribute("Approver7");

IWDAttributeInfo attrInfo8 = selValsNodeInfo.getAttribute("Approver8");

IWDAttributeInfo attrInfo9 = selValsNodeInfo.getAttribute("Approver9");

IWDAttributeInfo attrInfo10 = selValsNodeInfo.getAttribute("Approver10");

ISimpleTypeModifiable msType1 = attrInfo1.getModifiableSimpleType();

ISimpleTypeModifiable msType2 = attrInfo2.getModifiableSimpleType();

ISimpleTypeModifiable msType3 = attrInfo3.getModifiableSimpleType();

ISimpleTypeModifiable msType4 = attrInfo4.getModifiableSimpleType();

ISimpleTypeModifiable msType5 = attrInfo5.getModifiableSimpleType();

ISimpleTypeModifiable msType6 = attrInfo6.getModifiableSimpleType();

ISimpleTypeModifiable msType7 = attrInfo7.getModifiableSimpleType();

ISimpleTypeModifiable msType8 = attrInfo8.getModifiableSimpleType();

ISimpleTypeModifiable msType9 = attrInfo9.getModifiableSimpleType();

ISimpleTypeModifiable msType10 = attrInfo10.getModifiableSimpleType();

msType1.setFieldLabel("Name");

msType2.setFieldLabel("Name");

msType3.setFieldLabel("Name");

msType4.setFieldLabel("Name");

msType5.setFieldLabel("Name");

msType6.setFieldLabel("Name");

msType7.setFieldLabel("Name");

msType8.setFieldLabel("Name");

msType9.setFieldLabel("Name");

msType10.setFieldLabel("Name");

IModifiableSimpleValueSet valueSet1 = msType1.getSVServices().getModifiableSimpleValueSet();

IModifiableSimpleValueSet valueSet2 = msType2.getSVServices().getModifiableSimpleValueSet();

IModifiableSimpleValueSet valueSet3 = msType3.getSVServices().getModifiableSimpleValueSet();

IModifiableSimpleValueSet valueSet4 = msType4.getSVServices().getModifiableSimpleValueSet();

IModifiableSimpleValueSet valueSet5 = msType5.getSVServices().getModifiableSimpleValueSet();

IModifiableSimpleValueSet valueSet6 = msType6.getSVServices().getModifiableSimpleValueSet();

IModifiableSimpleValueSet valueSet7 = msType7.getSVServices().getModifiableSimpleValueSet();

IModifiableSimpleValueSet valueSet8 = msType8.getSVServices().getModifiableSimpleValueSet();

IModifiableSimpleValueSet valueSet9 = msType9.getSVServices().getModifiableSimpleValueSet();

IModifiableSimpleValueSet valueSet10 = msType10.getSVServices().getModifiableSimpleValueSet();

String name = "";

String first = "";

String last = "";

String fullname = "";

try {

InitialContext ctx5 = new InitialContext();

javax.sql.DataSource ds5 = (javax.sql.DataSource) ctx5.lookup("jdbc/SAP/BC_JMS");

java.sql.Connection con5 = ds5.getConnection();

java.sql.Statement select = con5.createStatement();

ResultSet result = select.executeQuery("SELECT DISPLAYNAME,FIRSTNAME,LASTNAME FROM AVD_UME_DATA " +

"ORDER BY FIRSTNAME, LASTNAME");

while (result.next()) {

name = result.getString(1);

first = result.getString(2);

last = result.getString(3);

fullname = last + "," + first;

valueSet1.put(name,fullname);

valueSet2.put(name,fullname);

valueSet3.put(name,fullname);

valueSet4.put(name,fullname);

valueSet5.put(name,fullname);

valueSet6.put(name,fullname);

valueSet7.put(name,fullname);

valueSet8.put(name,fullname);

valueSet9.put(name,fullname);

valueSet10.put(name,fullname);

}

con5.close();

}

catch (Exception e) {

}

//@@end

}

former_member182372
Active Contributor
0 Kudos

Hi Dana,

I`m not sure that my solution could improve perfomance of your application but at least you can try:

1) Create set of drop down by key UI elements and name them following some naming convention (ddbkValueSet1, ddbkValueSet2...)

2) Create fake context attribute (valueSet)

3) Change ModifiableSimpleValueSet only for valueSet attribute

4) Create context attributes based on valueSet attribute type:


IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute(IPrivateSDNView.IContextElement.VALUE_SET);
ISimpleTypeModifiable countryType = attributeInfo.getModifiableSimpleType();

IModifiableSimpleValueSet valueSet = countryType.getSVServices().getModifiableSimpleValueSet();

for (int i = 0; i < 40; i++)
{
	valueSet.put("Key_" + i, "Country "+i);
}

IWDNodeInfo rootInfo = wdContext.getNodeInfo();
for(int i=1;i<6;i++) 
{
	rootInfo.addAttribute("valueSet" + i, countryType);
}

5) in wdDoModifyView:


for(int i=1;i<6;i++) 
{
	IWDAttributeInfo attrInfo = wdContext.getNodeInfo().getAttribute("valueSet" + i);
	IWDDropDownByKey ddbkValueSet = (IWDDropDownByKey)view.getElement("ddbkValueSet" + i);
	ddbkValueSet.bindSelectedKey(attrInfo);
}

Best regards, Maksim Rashchynski.