• morganeCRMCLOUDER
  • NEWBIE
  • 25 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 8
    Questions
  • 11
    Replies

Hello, 

 

I have a map like this :

 

Map<String, Double> myMap;

I filled it with a loop, it's works fine.  

 

Now how do I udpate the fields corresponding to this query : 

 

List<UBI__SnOP_Planning_Record__c> listQuery = [SELECT id, Quantity__c   FROM myTable ]

 

with the values from myMap ? 

Hello,

 

I have a visualforce page containing a table in html (<table><td> ...). 

The user can fill input text boxes with values, and I'd like to do a "save method" to save the new values. 

 

Is it possible ? (without using <apex:inputText>) 

 

 

Thank you for any piece of information, 

Hello, 

 

I want to fill this matrice : 

http://img835.imageshack.us/img835/858/ao58.jpg

 

To do so, I have a class building a matrice (parameters are the dimension, and a list of values coming from the database) and here is the method from the controller : 

 

webService static String buildMatrix(){
  MT_Line values = new MT_line();    // list of numbers 
  MT_Matrix matrice = new MT_Matrix(10,10, values);   // a 10x10 matrix
  String JSONString = JSON.serializePretty(matrice);
return JSONString;

 

Here is the begining of the code in my visualforce page :

 

<apex:page controller="MT_controller" id="MT_id">
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
    <apex:includeScript value="/soap/ajax/15.0/connection.js"/>
	<apex:includeScript value="/soap/ajax/15.0/apex.js"/>
    <script src="../../soap/ajax/28.0/connection.js" type="text/javascript"></script>
    
    <script type="text/javascript">
		$jquery = jQuery.noConflict();
		sforce.connection.sessionId = '{!$Api.Session_ID}';
        var matrice = sforce.apex.execute("MT_controller","buildMatrix",{ });
     	alert(matrice.type);
    </script>

 

 

My question is simple : 

how do I fill the matrix with the values contained in the JSON object ? 

(please be as clear as possible, i am a beginner with  JSON and salesforce)  

 

Thank you 

 

Hello, 

 

Could somebody help me to set this constructor for a matrix ?

 

 

Here is the line class  (a line is a list of 16 input values): 

 

public with sharing class MT_line {

    private List<Double> MT_Double;

     public MT_line(){
             MT_Double = new Double[16];
      }

}

 

and here is the matrix class  

public with sharing class MT_Matrix {
  List<MT_Line> MT_Matrix;

   public MT_Matrix (){
      MT_Matrix=new MT_Line[] {new MT_Line(), new MT_Line()};
   }

    public MT_Matrix (integer SizeX, integer SizeY){
        MT_Matrix = new MT_Line[] {new MT_Line(), new MT_Line()};
          for(integer i= 0; i < SizeX; i ++){
            for(integer j = 0; j < SizeY; j++){ 
                 **** need help here ***
            }
         }
       }

 

Hello, I should have missed something about lists from queries. Here is what I have :

 

@isTest 
private class MT_Production_Test{ 

static testMethod void validate_Production() { 
  List production = [SELECT name FROM Production__c ]; 
  integer listSize= production.size(); 
  System.debug('size of the list ' + listSize); 

}

 

 When I check the file for the result of the test, it shows up "0" for the size (though the file compiles, and the query in itself works (getting 3 rows). Why ? Where am I wrong ?

Hello,

 

Here is a data table with input fields and calculated field.

http://img689.imageshack.us/img689/4324/sanstitreyof.jpg


However, it would take too long to use get methods on each field on each column to set the values requested on certain fields.

 

for ex, here is how I set the 3rd row of the table on my list called "production":


Decimal iniStock = production.get(0).S1__c; Decimal extProd = production.get(1).S1__c; String idProd = production.get(2).id; Decimal resSum1 = iniStock + extProd; Production__c prodAvai = new Production__c(Name='Available', Tech_name__c='AVASTO0', S1__c = resSum, id = idProd); production.set(2, prodAvai);

 

 

 Is there a way (maybe a pointer) to loop from S1 to S2 ... to S5 (so that I don't have to re write the same operation for every column) ? 

Hello,

 

I have a list of custom objects. 

I want to update an element of this list so I remove it and then add it (it's the only thing I've found). 

I refered to the list methods and the example here : http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_list.htm

 

But when I refresh the page, there is an error saying the elemnt is duplicate. I checked the log with some system.debug and it is indeed not removed from the list. Can someone explain why ? 

 

I tried both : 

myList.remove(2)       and 

whateverObject__c removedObj = myList.remove(2) 

 

Here is the code of the controller : 

 

public List<Production__c> production { get; set; }
  
    
    public List<Production__c> getName() {
        if(production== null) 
            production= [SELECT ID_Prod__c, name, Tech_name__c, S1__c
                         FROM Production__c 
                         WHERE ID_Prod__c = 1 OR ID_Prod__c = 2 OR ID_Prod__c = 3
                         ORDER BY ID_Prod__c ];
      
        
       Production__c prodAvai = new Production__c(Name='Available', 
                                                   Tech_name__c='AVASTO0', 
                                                   S1__c= 44,
                                                 ID_Prod__c=3);
       
        
      
        production.remove(2);  
        /* or as the doc says : 
        Production__c prodRemoved = production.remove(2);
        */

        Integer nb = production.size();
        System.debug('nb element after rm ' + nb);
        production.add(prodAvai);    // won't work because production[2] is still here 
      
       
        // loop to check the list
        for(Integer i = 0; i < production.size(); i++)
            System.debug('élément ' + i + ' = ' + production[i]);
         

        return production;
    }

 

 

Hello, 

 

I am an intern and a beginner in SalesForce. 

Sorry if my question is dumb but how do we access one particular row in a column of results displayed with a query ? 

 

Context : A data table with lists of numbers for Production (cutom object called Production__c). Some of the field of the table are calculated, like in Excel for eg. 

 

Here is the visualpage 

<apex:page controller="tabController" id="thePage">

    <apex:form >
    <apex:pageBlock >
        <apex:pageBlockButtons >
        <apex:commandButton action="{!save}" value="Save New Values" />
        </apex:pageBlockButtons>
   	 	<apex:dataTable value="{!name}" var="produc" id="theTable" rowClasses="odd,even" cellPadding="4" border="1">

        <apex:facet name="caption">Productions</apex:facet>
  
            <apex:column >
               <apex:facet name="header">Master production schedule</apex:facet>
               <apex:outputText value="{!produc.name}"/>
            </apex:column>
        
        
            <apex:column width="100">
                <apex:facet name="header">Technical name</apex:facet>
                <apex:outputText value="{!produc.Tech_name__c}"/>
            </apex:column>
        
            <apex:column >
                <apex:facet name="header">S1</apex:facet>
                <apex:inputText size="2" styleclass="input" value="{!produc.S1__c}"/>
        </apex:column>
    </apex:dataTable>
</apex:pageBlock>      
</apex:form>
</apex:page>

 

and the controller (to get the values from the database) 

 

public with sharing class tabController {

    public String prod {get; set;}
    
    
  public List<Production__c> production { get; set; }
    
    public List<Production__c> getName() {
        if(production== null) 
            production= [SELECT name, Tech_name__c, S1__c FROM Production__c ];
        return production;
    }


    public PageReference save() {
        update production;
        return null;
    }
    
}

 

 

and also a screenshot of the page (where underlined row must be calculated)

http://img594.imageshack.us/img594/4366/screenju.jpg

 

Hello, 

 

I have a map like this :

 

Map<String, Double> myMap;

I filled it with a loop, it's works fine.  

 

Now how do I udpate the fields corresponding to this query : 

 

List<UBI__SnOP_Planning_Record__c> listQuery = [SELECT id, Quantity__c   FROM myTable ]

 

with the values from myMap ? 

Hello,

 

I have a visualforce page containing a table in html (<table><td> ...). 

The user can fill input text boxes with values, and I'd like to do a "save method" to save the new values. 

 

Is it possible ? (without using <apex:inputText>) 

 

 

Thank you for any piece of information, 

Hello, 

 

Could somebody help me to set this constructor for a matrix ?

 

 

Here is the line class  (a line is a list of 16 input values): 

 

public with sharing class MT_line {

    private List<Double> MT_Double;

     public MT_line(){
             MT_Double = new Double[16];
      }

}

 

and here is the matrix class  

public with sharing class MT_Matrix {
  List<MT_Line> MT_Matrix;

   public MT_Matrix (){
      MT_Matrix=new MT_Line[] {new MT_Line(), new MT_Line()};
   }

    public MT_Matrix (integer SizeX, integer SizeY){
        MT_Matrix = new MT_Line[] {new MT_Line(), new MT_Line()};
          for(integer i= 0; i < SizeX; i ++){
            for(integer j = 0; j < SizeY; j++){ 
                 **** need help here ***
            }
         }
       }

 

Hello, I should have missed something about lists from queries. Here is what I have :

 

@isTest 
private class MT_Production_Test{ 

static testMethod void validate_Production() { 
  List production = [SELECT name FROM Production__c ]; 
  integer listSize= production.size(); 
  System.debug('size of the list ' + listSize); 

}

 

 When I check the file for the result of the test, it shows up "0" for the size (though the file compiles, and the query in itself works (getting 3 rows). Why ? Where am I wrong ?

Hello,

 

Here is a data table with input fields and calculated field.

http://img689.imageshack.us/img689/4324/sanstitreyof.jpg


However, it would take too long to use get methods on each field on each column to set the values requested on certain fields.

 

for ex, here is how I set the 3rd row of the table on my list called "production":


Decimal iniStock = production.get(0).S1__c; Decimal extProd = production.get(1).S1__c; String idProd = production.get(2).id; Decimal resSum1 = iniStock + extProd; Production__c prodAvai = new Production__c(Name='Available', Tech_name__c='AVASTO0', S1__c = resSum, id = idProd); production.set(2, prodAvai);

 

 

 Is there a way (maybe a pointer) to loop from S1 to S2 ... to S5 (so that I don't have to re write the same operation for every column) ? 

Hello, 

 

I am an intern and a beginner in SalesForce. 

Sorry if my question is dumb but how do we access one particular row in a column of results displayed with a query ? 

 

Context : A data table with lists of numbers for Production (cutom object called Production__c). Some of the field of the table are calculated, like in Excel for eg. 

 

Here is the visualpage 

<apex:page controller="tabController" id="thePage">

    <apex:form >
    <apex:pageBlock >
        <apex:pageBlockButtons >
        <apex:commandButton action="{!save}" value="Save New Values" />
        </apex:pageBlockButtons>
   	 	<apex:dataTable value="{!name}" var="produc" id="theTable" rowClasses="odd,even" cellPadding="4" border="1">

        <apex:facet name="caption">Productions</apex:facet>
  
            <apex:column >
               <apex:facet name="header">Master production schedule</apex:facet>
               <apex:outputText value="{!produc.name}"/>
            </apex:column>
        
        
            <apex:column width="100">
                <apex:facet name="header">Technical name</apex:facet>
                <apex:outputText value="{!produc.Tech_name__c}"/>
            </apex:column>
        
            <apex:column >
                <apex:facet name="header">S1</apex:facet>
                <apex:inputText size="2" styleclass="input" value="{!produc.S1__c}"/>
        </apex:column>
    </apex:dataTable>
</apex:pageBlock>      
</apex:form>
</apex:page>

 

and the controller (to get the values from the database) 

 

public with sharing class tabController {

    public String prod {get; set;}
    
    
  public List<Production__c> production { get; set; }
    
    public List<Production__c> getName() {
        if(production== null) 
            production= [SELECT name, Tech_name__c, S1__c FROM Production__c ];
        return production;
    }


    public PageReference save() {
        update production;
        return null;
    }
    
}

 

 

and also a screenshot of the page (where underlined row must be calculated)

http://img594.imageshack.us/img594/4366/screenju.jpg

 

I'm trying to create a VF page that displays a table of Opportunity and Contract values.  I need to use an IF statement so that blank rows don't get created if the test condition is false.  I'm not able to escape the HTML tags so that the browser treats them as HTML instead of text.

Here is an example of what I'm trying to do;

<apex:page standardController="Opportunity">
   
             <table border="1" cellPadding="4">       
          <TR> <TH> Name of Fee </TH> <TH>Current Fee</TH> <TH> Updated Fee </TH> </TR>
          <TR><TD>
        {!IF((Opportunity.Contract__r.FieldA = Opportunity.FieldB),
         'Standard Fee:' & ' </TD> <TD> ' & TEXT(Opportunity.Contract__r.FieldA) &  ' </TD><TD> ' &     TEXT(Opportunity.Field)  , "" )}                                                                                
          </TD></TR>                                              
          </table>
       </apex:page>

Hi,

 

 

I need to create one Grid Structure in Visualforce page. The row Headings and Column headings will get populatetd from 2 lists. Can anybody please tell me how to achieve this..

 

I will give one example. Say, I have a list of Strings containings Account Names and another List containing Contact Names. Now, I need to keep Account Names in rows and Contact names in columns. At least I am trying to acheve this before proceeding further.

 

Please help..

 

Thanks in advance,

Suvra

  • June 29, 2009
  • Like
  • 0

Nomal behaviour in vf tables is to display one object per row of a table, with your desired fields as columns.

I'm trying to create a page where only one field per object is shown but they are displayed horizontally.

 

<apex:dataTable id="teamtable" value="{!MyTeam}" var="person">
  <apex:column > <apex:image url="{!person.Photo_URL__c}" height="150" width="200" /> </apex:column>
  <apex:column > <apex:outputText value="{!person.Name__c}" /> </apex:column>
</apex:dataTable>

 

So this is displaying all the team members vertically with a lot of white space on the right. Ideally I'd like to have 4 or 5 team members photos on a line each with their name underneath. Is this possible in VF ?