Skip to main content
added 21 characters in body
Source Link
Matt K
  • 3.4k
  • 3
  • 25
  • 55

When trying to understand some new programming concepts or the specifics of a new language or API, the documentation is invaluable. Here's a couple of resources for you.

Here are some details about the specific code snippets you had questions about.

  1. Check out the Exception documentation for e.getMessage();, String Methods documentation for indexOf(), and ApexPages documentation.

    String msg=e.getMessage(); // get the error message integer pos;

    // if its field validation, this will be added to the messages by default if (-1==(pos=msg.indexOf('FIELD_CUSTOM_VALIDATION_EXCEPTION, '))) { ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, msg)); }

    result=false;

  2. PageReference documentation

    pr.setRedirect(true);

  3. The null here is assigning no"no value" (or a blank value) to all of those variables. I'm not entirely sure what that's doing. It could be resetting the values so that they can be used to insert another skid__c.

    public void newSkid() { if (updateSkids()) { Skid__c skid=new Skid__c(Name=newSkidName, Dimension__c=newSkidDimension, Number_of_Pieces__c=newSkidNumberofPieces, UOM__c=newskiduom, Weight__c=newskidweight, Bill_of_Lading__c=getBillofLading().id); insert skid;

       newSkidName=null;
       newSkidDimension=null;
       newSkidNumberofPieces=null;
       newskidbilloflading=null; 
       newskiduom=null;
       newskidweight=null;
       skids=null;
    
  4. The comparison with null!= here is checking to see if the chosenskidId has a value. It might be better understood as if(chosenskidId != null) which is an equivalent statement.

    public void deleteSkid() { if (updateSkids()) { if (null!=chosenskidId) { Skid__c skid=new Skid__c(Id=chosenskidId); delete skid;

           skids=null;
           chosenskidId=null;
       }
    }
    

    }

  5. The null statement again here is basically saying: If the resulting sObject (or variable) Id from the function, getBillofLading(), has a value and skids is does not have a value, do the following statements between the brackets { and }.

    public List<Skid__c> getSkids() { if ( (null!=getBillofLading().id) && (skids == null) ) { skids=[SELECT Id, Name, Bill_of_Lading__c,
    Dimension__c, Number_of_Pieces__c, UOM__c, Weight__c FROM Skid__c WHERE Id =: getBillofLading().id ORDER BY CreatedDate];

  6. See the inline comments for these functions. Also, check out the ApexPages documentation and the PageReference documentation.

    public String getChooserender() { // if the current page has a 'p' QueryString Parameter if (ApexPages.currentPage().getParameters().get('p') != null) return 'pdf'; // return 'pdf' else return null; }

    public PageReference deliverAsPDF() { // create a new PageReference to the Page named 'Billofladingtest05222013' PageReference pdf = Page.Billofladingtest05222013; // add the 'p' QueryString Parameter pdf.getParameters().put('p','p'); // return the PageReference return pdf; }

When trying to understand some new programming concepts or the specifics of a new language or API, the documentation is invaluable. Here's a couple of resources for you.

Here are some details about the specific code snippets you had questions about.

  1. Check out the Exception documentation for e.getMessage();, String Methods documentation for indexOf(), and ApexPages documentation.

    String msg=e.getMessage(); // get the error message integer pos;

    // if its field validation, this will be added to the messages by default if (-1==(pos=msg.indexOf('FIELD_CUSTOM_VALIDATION_EXCEPTION, '))) { ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, msg)); }

    result=false;

  2. PageReference documentation

    pr.setRedirect(true);

  3. The null here is assigning no value to all of those variables. I'm not entirely sure what that's doing. It could be resetting the values so that they can be used to insert another skid__c.

    public void newSkid() { if (updateSkids()) { Skid__c skid=new Skid__c(Name=newSkidName, Dimension__c=newSkidDimension, Number_of_Pieces__c=newSkidNumberofPieces, UOM__c=newskiduom, Weight__c=newskidweight, Bill_of_Lading__c=getBillofLading().id); insert skid;

       newSkidName=null;
       newSkidDimension=null;
       newSkidNumberofPieces=null;
       newskidbilloflading=null; 
       newskiduom=null;
       newskidweight=null;
       skids=null;
    
  4. The comparison with null!= here is checking to see if the chosenskidId has a value. It might be better understood as if(chosenskidId != null) which is an equivalent statement.

    public void deleteSkid() { if (updateSkids()) { if (null!=chosenskidId) { Skid__c skid=new Skid__c(Id=chosenskidId); delete skid;

           skids=null;
           chosenskidId=null;
       }
    }
    

    }

  5. The null statement again here is basically saying: If the resulting sObject (or variable) Id from the function getBillofLading() has a value and skids is does not have a value.

    public List<Skid__c> getSkids() { if ( (null!=getBillofLading().id) && (skids == null) ) { skids=[SELECT Id, Name, Bill_of_Lading__c,
    Dimension__c, Number_of_Pieces__c, UOM__c, Weight__c FROM Skid__c WHERE Id =: getBillofLading().id ORDER BY CreatedDate];

  6. See the inline comments for these functions. Also, check out the ApexPages documentation and the PageReference documentation.

    public String getChooserender() { // if the current page has a 'p' QueryString Parameter if (ApexPages.currentPage().getParameters().get('p') != null) return 'pdf'; // return 'pdf' else return null; }

    public PageReference deliverAsPDF() { // create a new PageReference to the Page named 'Billofladingtest05222013' PageReference pdf = Page.Billofladingtest05222013; // add the 'p' QueryString Parameter pdf.getParameters().put('p','p'); // return the PageReference return pdf; }

When trying to understand some new programming concepts or the specifics of a new language or API, the documentation is invaluable. Here's a couple of resources for you.

Here are some details about the specific code snippets you had questions about.

  1. Check out the Exception documentation for e.getMessage();, String Methods documentation for indexOf(), and ApexPages documentation.

    String msg=e.getMessage(); // get the error message integer pos;

    // if its field validation, this will be added to the messages by default if (-1==(pos=msg.indexOf('FIELD_CUSTOM_VALIDATION_EXCEPTION, '))) { ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, msg)); }

    result=false;

  2. PageReference documentation

    pr.setRedirect(true);

  3. The null here is assigning "no value" (or a blank value) to all of those variables. I'm not entirely sure what that's doing. It could be resetting the values so that they can be used to insert another skid__c.

    public void newSkid() { if (updateSkids()) { Skid__c skid=new Skid__c(Name=newSkidName, Dimension__c=newSkidDimension, Number_of_Pieces__c=newSkidNumberofPieces, UOM__c=newskiduom, Weight__c=newskidweight, Bill_of_Lading__c=getBillofLading().id); insert skid;

       newSkidName=null;
       newSkidDimension=null;
       newSkidNumberofPieces=null;
       newskidbilloflading=null; 
       newskiduom=null;
       newskidweight=null;
       skids=null;
    
  4. The comparison with null!= here is checking to see if the chosenskidId has a value. It might be better understood as if(chosenskidId != null) which is an equivalent statement.

    public void deleteSkid() { if (updateSkids()) { if (null!=chosenskidId) { Skid__c skid=new Skid__c(Id=chosenskidId); delete skid;

           skids=null;
           chosenskidId=null;
       }
    }
    

    }

  5. The null statement again here is basically saying: If the resulting sObject (or variable) Id from the function, getBillofLading(), has a value and skids is does not have a value, do the following statements between the brackets { and }.

    public List<Skid__c> getSkids() { if ( (null!=getBillofLading().id) && (skids == null) ) { skids=[SELECT Id, Name, Bill_of_Lading__c,
    Dimension__c, Number_of_Pieces__c, UOM__c, Weight__c FROM Skid__c WHERE Id =: getBillofLading().id ORDER BY CreatedDate];

  6. See the inline comments for these functions. Also, check out the ApexPages documentation and the PageReference documentation.

    public String getChooserender() { // if the current page has a 'p' QueryString Parameter if (ApexPages.currentPage().getParameters().get('p') != null) return 'pdf'; // return 'pdf' else return null; }

    public PageReference deliverAsPDF() { // create a new PageReference to the Page named 'Billofladingtest05222013' PageReference pdf = Page.Billofladingtest05222013; // add the 'p' QueryString Parameter pdf.getParameters().put('p','p'); // return the PageReference return pdf; }

added 4 characters in body
Source Link
Matt K
  • 3.4k
  • 3
  • 25
  • 55

When trying to understand some new programming concepts or the specifics of a new language or API, the documentation is invaluable. Here's a couple of resources for you.

Here are some details about the specific code snippets you had questions about.

  1. Check out the Exception documentation for e.getMessage();, String Methods documentation for indexOf(), and ApexPages documentation.

    String msg=e.getMessage(); // get the error message integer pos;

    // if its field validation, this will be added to the messages by default if (-1==(pos=msg.indexOf('FIELD_CUSTOM_VALIDATION_EXCEPTION, '))) { ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, msg)); }

    result=false;

  2. PageReference documentation

    pr.setRedirect(true);

  3. The null here is blanking outassigning no value to all of the values for those variables. I'm not entirely sure what that's doing. It could be resetting the values so that they can be used to insert another skid__c.

    public void newSkid() { if (updateSkids()) { Skid__c skid=new Skid__c(Name=newSkidName, Dimension__c=newSkidDimension, Number_of_Pieces__c=newSkidNumberofPieces, UOM__c=newskiduom, Weight__c=newskidweight, Bill_of_Lading__c=getBillofLading().id); insert skid;

       newSkidName=null;
       newSkidDimension=null;
       newSkidNumberofPieces=null;
       newskidbilloflading=null; 
       newskiduom=null;
       newskidweight=null;
       skids=null;
    
  4. The comparison with null!= here is checking to see if the chosenskidId is not blankhas a value. It might be better understood as if(chosenskidId != null) which is an equivalent statement.

    public void deleteSkid() { if (updateSkids()) { if (null!=chosenskidId) { Skid__c skid=new Skid__c(Id=chosenskidId); delete skid;

           skids=null;
           chosenskidId=null;
       }
    }
    

    }

  5. The null statement again here is basically saying: If the resulting sObject (or variable) Id from the function getBillofLading() is not blankhas a value and skids is does not blankhave a value.

    public List<Skid__c> getSkids() { if ( (null!=getBillofLading().id) && (skids == null) ) { skids=[SELECT Id, Name, Bill_of_Lading__c,
    Dimension__c, Number_of_Pieces__c, UOM__c, Weight__c FROM Skid__c WHERE Id =: getBillofLading().id ORDER BY CreatedDate];

  6. See the inline comments for these functions. Also, check out the ApexPages documentation and the PageReference documentation.

    public String getChooserender() { // if the current page has a 'p' QueryString Parameter if (ApexPages.currentPage().getParameters().get('p') != null) return 'pdf'; // return 'pdf' else return null; }

    public PageReference deliverAsPDF() { // create a new PageReference to the Page named 'Billofladingtest05222013' PageReference pdf = Page.Billofladingtest05222013; // add the 'p' QueryString Parameter pdf.getParameters().put('p','p'); // return the PageReference return pdf; }

When trying to understand some new programming concepts or the specifics of a new language or API, the documentation is invaluable. Here's a couple of resources for you.

Here are some details about the specific code snippets you had questions about.

  1. Check out the Exception documentation for e.getMessage();, String Methods documentation for indexOf(), and ApexPages documentation.

    String msg=e.getMessage(); // get the error message integer pos;

    // if its field validation, this will be added to the messages by default if (-1==(pos=msg.indexOf('FIELD_CUSTOM_VALIDATION_EXCEPTION, '))) { ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, msg)); }

    result=false;

  2. PageReference documentation

    pr.setRedirect(true);

  3. The null here is blanking out all of the values for those variables. I'm not entirely sure what that's doing. It could be resetting the values so that they can be used to insert another skid__c.

    public void newSkid() { if (updateSkids()) { Skid__c skid=new Skid__c(Name=newSkidName, Dimension__c=newSkidDimension, Number_of_Pieces__c=newSkidNumberofPieces, UOM__c=newskiduom, Weight__c=newskidweight, Bill_of_Lading__c=getBillofLading().id); insert skid;

       newSkidName=null;
       newSkidDimension=null;
       newSkidNumberofPieces=null;
       newskidbilloflading=null; 
       newskiduom=null;
       newskidweight=null;
       skids=null;
    
  4. The comparison with null!= here is checking to see if the chosenskidId is not blank. It might be better understood as if(chosenskidId != null) which is an equivalent statement.

    public void deleteSkid() { if (updateSkids()) { if (null!=chosenskidId) { Skid__c skid=new Skid__c(Id=chosenskidId); delete skid;

           skids=null;
           chosenskidId=null;
       }
    }
    

    }

  5. The null statement again here is basically saying: If the resulting sObject (or variable) Id from the function getBillofLading() is not blank and skids is not blank.

    public List<Skid__c> getSkids() { if ( (null!=getBillofLading().id) && (skids == null) ) { skids=[SELECT Id, Name, Bill_of_Lading__c,
    Dimension__c, Number_of_Pieces__c, UOM__c, Weight__c FROM Skid__c WHERE Id =: getBillofLading().id ORDER BY CreatedDate];

  6. See the inline comments for these functions. Also, check out the ApexPages documentation and the PageReference documentation.

    public String getChooserender() { // if the current page has a 'p' QueryString Parameter if (ApexPages.currentPage().getParameters().get('p') != null) return 'pdf'; // return 'pdf' else return null; }

    public PageReference deliverAsPDF() { // create a new PageReference to the Page named 'Billofladingtest05222013' PageReference pdf = Page.Billofladingtest05222013; // add the 'p' QueryString Parameter pdf.getParameters().put('p','p'); // return the PageReference return pdf; }

When trying to understand some new programming concepts or the specifics of a new language or API, the documentation is invaluable. Here's a couple of resources for you.

Here are some details about the specific code snippets you had questions about.

  1. Check out the Exception documentation for e.getMessage();, String Methods documentation for indexOf(), and ApexPages documentation.

    String msg=e.getMessage(); // get the error message integer pos;

    // if its field validation, this will be added to the messages by default if (-1==(pos=msg.indexOf('FIELD_CUSTOM_VALIDATION_EXCEPTION, '))) { ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, msg)); }

    result=false;

  2. PageReference documentation

    pr.setRedirect(true);

  3. The null here is assigning no value to all of those variables. I'm not entirely sure what that's doing. It could be resetting the values so that they can be used to insert another skid__c.

    public void newSkid() { if (updateSkids()) { Skid__c skid=new Skid__c(Name=newSkidName, Dimension__c=newSkidDimension, Number_of_Pieces__c=newSkidNumberofPieces, UOM__c=newskiduom, Weight__c=newskidweight, Bill_of_Lading__c=getBillofLading().id); insert skid;

       newSkidName=null;
       newSkidDimension=null;
       newSkidNumberofPieces=null;
       newskidbilloflading=null; 
       newskiduom=null;
       newskidweight=null;
       skids=null;
    
  4. The comparison with null!= here is checking to see if the chosenskidId has a value. It might be better understood as if(chosenskidId != null) which is an equivalent statement.

    public void deleteSkid() { if (updateSkids()) { if (null!=chosenskidId) { Skid__c skid=new Skid__c(Id=chosenskidId); delete skid;

           skids=null;
           chosenskidId=null;
       }
    }
    

    }

  5. The null statement again here is basically saying: If the resulting sObject (or variable) Id from the function getBillofLading() has a value and skids is does not have a value.

    public List<Skid__c> getSkids() { if ( (null!=getBillofLading().id) && (skids == null) ) { skids=[SELECT Id, Name, Bill_of_Lading__c,
    Dimension__c, Number_of_Pieces__c, UOM__c, Weight__c FROM Skid__c WHERE Id =: getBillofLading().id ORDER BY CreatedDate];

  6. See the inline comments for these functions. Also, check out the ApexPages documentation and the PageReference documentation.

    public String getChooserender() { // if the current page has a 'p' QueryString Parameter if (ApexPages.currentPage().getParameters().get('p') != null) return 'pdf'; // return 'pdf' else return null; }

    public PageReference deliverAsPDF() { // create a new PageReference to the Page named 'Billofladingtest05222013' PageReference pdf = Page.Billofladingtest05222013; // add the 'p' QueryString Parameter pdf.getParameters().put('p','p'); // return the PageReference return pdf; }

Source Link
Matt K
  • 3.4k
  • 3
  • 25
  • 55

When trying to understand some new programming concepts or the specifics of a new language or API, the documentation is invaluable. Here's a couple of resources for you.

Here are some details about the specific code snippets you had questions about.

  1. Check out the Exception documentation for e.getMessage();, String Methods documentation for indexOf(), and ApexPages documentation.

    String msg=e.getMessage(); // get the error message integer pos;

    // if its field validation, this will be added to the messages by default if (-1==(pos=msg.indexOf('FIELD_CUSTOM_VALIDATION_EXCEPTION, '))) { ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, msg)); }

    result=false;

  2. PageReference documentation

    pr.setRedirect(true);

  3. The null here is blanking out all of the values for those variables. I'm not entirely sure what that's doing. It could be resetting the values so that they can be used to insert another skid__c.

    public void newSkid() { if (updateSkids()) { Skid__c skid=new Skid__c(Name=newSkidName, Dimension__c=newSkidDimension, Number_of_Pieces__c=newSkidNumberofPieces, UOM__c=newskiduom, Weight__c=newskidweight, Bill_of_Lading__c=getBillofLading().id); insert skid;

       newSkidName=null;
       newSkidDimension=null;
       newSkidNumberofPieces=null;
       newskidbilloflading=null; 
       newskiduom=null;
       newskidweight=null;
       skids=null;
    
  4. The comparison with null!= here is checking to see if the chosenskidId is not blank. It might be better understood as if(chosenskidId != null) which is an equivalent statement.

    public void deleteSkid() { if (updateSkids()) { if (null!=chosenskidId) { Skid__c skid=new Skid__c(Id=chosenskidId); delete skid;

           skids=null;
           chosenskidId=null;
       }
    }
    

    }

  5. The null statement again here is basically saying: If the resulting sObject (or variable) Id from the function getBillofLading() is not blank and skids is not blank.

    public List<Skid__c> getSkids() { if ( (null!=getBillofLading().id) && (skids == null) ) { skids=[SELECT Id, Name, Bill_of_Lading__c,
    Dimension__c, Number_of_Pieces__c, UOM__c, Weight__c FROM Skid__c WHERE Id =: getBillofLading().id ORDER BY CreatedDate];

  6. See the inline comments for these functions. Also, check out the ApexPages documentation and the PageReference documentation.

    public String getChooserender() { // if the current page has a 'p' QueryString Parameter if (ApexPages.currentPage().getParameters().get('p') != null) return 'pdf'; // return 'pdf' else return null; }

    public PageReference deliverAsPDF() { // create a new PageReference to the Page named 'Billofladingtest05222013' PageReference pdf = Page.Billofladingtest05222013; // add the 'p' QueryString Parameter pdf.getParameters().put('p','p'); // return the PageReference return pdf; }