+ Start a Discussion
prakash chaudharyprakash chaudhary 

must see it....

Hiiii

I am making information in tabular format..

When I put information with single goal then it shows in data proper but when i insert more than one goal then data comes like adding one cell next to previous one like

 

Goal1  Goal2 Equity1 Equity2 Debt1 Debt2  Gold1 Gold2

 

But I need it like this

 

Goal1  Equity1  Debt1  Gold1

Goal2  Equity2  Debt2  Gold2

 

Please tell me how can I do it since my value are from database...

My code is..

<apex:repeat id="hd" value="{!beanObj.goalList}" var="golObj">
      <tr>
          <td class="textStyle" style="width:40px">{!golObj.Description__c}</td>

              
          <apex:repeat value="{!beanObj.sipList}" var="aseObj">
              <apex:repeat value="{!aseObj.golListVals}" var="gObj">
                  <td class="textStyle" style="width:40px;text-align:right;">  
                   <apex:outputText value="{0, number, ,##,##0}" >
                        <apex:param value="{!gObj}"/>
                   </apex:outputText>
                  </td>  
              </apex:repeat>
          </apex:repeat>    
                         
          
          <apex:repeat value="{!beanObj.totSIPList}" var="totObj">
              <td class="textStyle" style="width:40px;text-align:right;">
                   <apex:outputText value="{0, number, ,##,##0}" >
                        <apex:param value="{!totObj}"/>
                   </apex:outputText>
              </td>
          </apex:repeat>
          
          <apex:repeat id="hd1" value="{!beanObj.asetList}" var="aseObj">
          <apex:repeat value="{!aseObj.golListVals}" var="gObj">
              <td class="textStyle" style="width:40px;text-align:right;">
                  <apex:outputText value="{0, number, ,##,##0}" >
                       <apex:param value="{!gObj}"/>
                  </apex:outputText>
              </td>
          </apex:repeat>
          </apex:repeat>
          
          <apex:repeat id="hd111" value="{!beanObj.totLumpSumList}" var="totObj">
              <td class="textStyle" style="width:40px;text-align:right;">
                   <apex:outputText value="{0, number, ,##,##0}" >
                       <apex:param value="{!totObj}"/>
                   </apex:outputText>
              </td>
          </apex:repeat>
              
      </tr>
      </apex:repeat>

 

sfdcfoxsfdcfox

It appears that your loops are written wrong. Not only would they show up side by side, as you observed, multiple goals should cause the entire thing to explode in size. The problem is that you presumably think that tables are rendered from top to bottom, or that repeat tags within repeat tags execute only one item at a time for each iteration, both of which is untrue.

 

So... I'm honestly confused as to your final layout. I get that you have a list of SIPs, a total for each list, and an asset list, and a total lump sum list. The best I came up with is the following:

 

<apex:dataTable value="{!beanObj.indices}" var="index">
	<apex:column breakBefore="true" class="textStyle" style="width:40px;text-align:right;">
		{!beanObj.goalList[index].Description__c}
	</apex:column>
	<apex:column class="textStyle" style="width:40px;text-align:right;">
		<apex:repeat value="{!beanObj.sipList[index]}" var="gObj">
			<apex:outputText value="{0, number, ,##,##0}" >
				<apex:param value="{!gObj}"/>
			</apex:outputText><br/>
		</apex:repeat>
	</apex:column>
	<apex:column class="textStyle" style="width:40px;text-align:right;">
		<apex:outputText value="{0, number, ,##,##0}" >
			<apex:param value="{!beanObj.totSIPList[index]}"/>
		</apex:outputText>
	</apex:column>
	<apex:column class="textStyle" style="width:40px;text-align:right;">
		<apex:repeat value="{!beanObj.asetList}" var="aseObj">
			<apex:outputText value="{0, number, ,##,##0}">
				<apex:param value="{!gObj}"/>
			</apex:outputText><br/>
		</apex:repeat>
	</apex:column>
	<apex:column class="textStyle" style="width:40px;text-align:right;">
		<apex:outputText value="{0, number, ,##,##0}" >
			<apex:param value="{!beanObj.totLumpSumList[index]}"/>
		</apex:outputText>
	</apex:column>
</apex:dataTable>

To get this design working, Indices should be a List<Integer>, populated with values from 0 to the size of your lists - 1. Make sure all your lists are the same size.

 

In the future, I'd recommend you write a wrapper class to make things look nicer.

 

I'm also not entirely sure this is going to look the way you want it to, but this is the best I can do with what I have to go on.

prakash chaudharyprakash chaudhary

Hiiii plz see the image below...

 

http://yfrog.com/khwn5fp 

 

I have Goal value in GoalList, SIP value in SIPList, total sip value in totSIPList, lumpsum value in LumpsumList so all have their own list so please tell me how can i make this type of table..

Since In my above code that show in first very well but the problem is after 1 row so please tell me how can i do that ?

sfdcfoxsfdcfox

Do not make this hard on yourself. While they may be sublists, there is no requirement that you implement them as lists in your code, and in fact it is making it only harder for you to complete your objectives. Instead, try something like this:

 

public class pageController {

	public pageController() {
		// Just one way to load data.
		loadGoals();
	}

	public class goalRow {
		public goalRow(string Description, integer sipEquity, integer sipDebt, integer sipGold, integer sumEquity, integer sumDebt, integerSumGold) {
			this.Description = Description;
			this.sipEquity = sipEquity;
			this.sipDebt = sipDebt;
			this.sipGold = sipGold;
			this.sumEquity = sumEquity;
			this.sumDebt = sumDebt;
			this.sumGold = sumGold;
		}
		public string Description { get; set; }
		public Integer sipEquity { get; set; }
		public Integer sipDebt { get; set; }
		public Integer sipGold { get; set; }
		public Integer sumEquity { get; set; }
		public Integer sumDebt { get; set; }
		public Integer sumGold { get; set; }
		public Integer getsumTotal() {
			return sumEquity + sumDebt + sumGold;
		}
		public Integer getsipTotal() {
			return sipEquity + sipDebt + sipGold;
		}
	}
	
	public list<goalRow> goalList { get; set; }

	// actual method to load goals.
	public void loadGoals() {
		goalList = new list<goalRow>();
		goalRow goalTotal = new goalRow(null,0,0,0,0,0,0);
		// change object and field names to suit.
		for(GoalData__c goal:[select id,name,sipequity__c,sipdebt__c,sipgold__c,sumequity__c,sumdebt__c,sumgold__c from GoalData__c where ownerid = :userinfo.getuserid()]) {
			goalList.add(new goalRow(goal.name,goal.sipequity__c,goal.sipdebt__c,goal.sipgold__c,goal.sumequity__c,goal.sumdebt__c,goal.sumgold__c));
			goalTotal.sipequity += goal.sipequity__c;
			goalTotal.sipdebt += goal.sipdebt__c;
			goalTotal.sipgold += goal.sipgold__c;
			goalTotal.sumequity += goal.sumequity__c;
			goalTotal.sumdebt += goal.sumdebt__c;
			goalTotal.sumgold += goal.sumgold__c;
		}
		goalList.add(goalTotal); // place totals line last.
	}
}

 

<!-- just the table generation, for demonstration -->
<apex:repeat value="{!goalList}" var="goalItem">
	<tr>
		<td>{!goalItem.Description}</td>
		<td>{!goalItem.sipEquity}</td>
		<td>{!goalItem.sipDebt}</td>
		<td>{!goalItem.sipGold}</td>
		<td>{!goalItem.sipTotal}</td>
		<td>{!goalItem.sumEquity}</td>
		<td>{!goalItem.sumDebt}</td>
		<td>{!goalItem.sumGold}</td>
		<td>{!goalItem.sumTotal}</td>
	</tr>
</apex:repeat>

 Although, the idea I posted earlier this morning should also work; it would require far less code modification than the example here.

 

The point of these examples is that you need to render from left to right, top to bottom (like a Z shape), and not top to bottom, left to right (like an inverted N shape). You don't need to make it any more difficult on yourself, and using lists to represent your data does just that.