• Nikhil M Kumar
  • NEWBIE
  • 15 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 6
    Replies
I have defined a Wrapper class inside a Main class.
When I try to use the Constructor of the Wrappe class outside the Wrapper class (except in Main Class Constructor), an error shows up as below:
Constructor not defined: [JSONParserUtil.JSONParserUtilWrapper].<Constructor>()
What can I do, so as to use the Wrapper class's Constructor in other methods of the Main class?
 
But, the 'IF' I write in the rendered attribute has a String method which doesn't run in there.
The error says...
Unknown function <String>.containsOnly('<SubString>'). Check spelling.

 
I have created a PushTopic on a Custom Object. It is as follows:
SELECT Id, Name, Price__c, Quantity__c FROM Item__c

Now, I am using the PushTopics from the workbench.developerforce.com to update my Visualforce Page accordingly whenever I update the data in the Backend!
Now, I tried to get connected using the Cometd and have followed a basic example procedure which doesn't allow me to get into the init() method even!
I don't understand what's wrong!

Anyone with a good understanding of the 'Cometd usage to update the VF Page' could give me some suggestions?
I'm trying to print a Barcode which displays fine in the Visualforce page, but, doesn't display when the Page is rendered as a PDF!
Why does this happen? And, help from anyone with the required resources is really appreciated!
Order__c od = new Order__c();
        
        for(Item__c it : addedItems){    //addedItems (type: List) already created and populated!
            it.Order__c = od.id;
        }

In the code, I'm trying to put the Items in 'addedItems' list, each, into the Order__c object.
<apex:page showHeader="false" sidebar="false" standardController="Hotel_Menu_Item__c" extensions="MenuTMS" recordSetVar="htlMenu">
    <apex:form >
        <apex:pageBlock title="Menu Items">
            <apex:outputText >Hello!</apex:outputText>
            <br/><br/>
            <apex:pageBlockTable value="{! htlMenu }" var="htl" cellspacing="10px" cellpadding="10px">
                <apex:column value="{! htl.Name }" />
                <apex:column value="{! htl.Price__c }" />
                <apex:column > <apex:inputText style="width: 50px" value="{!htl.Quantity__c}" /> </apex:column>
            </apex:pageBlockTable>
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save" />
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>


public class MenuTMS {
    public List <Hotel_Menu_Item__c> ItemDetails { get; set;}
    
    public ApexPages.StandardSetController stdSetController {get; set;}
    
    public ApexPages.StandardController stdController {get; set;}
    
    public static PageReference save(){
        
        List <Hotel_Menu_Item__c> ItemDetails = [SELECT Id,Name,Price__c,Quantity__c FROM Hotel_Menu_Item__c WHERE Quantity__c != NULL];
        
		List <Double> Amount = new List <Double> ();
        for(Integer i = 0; i < ItemDetails.size(); i++){
            Amount.add((ItemDetails[i].Price__c) * (ItemDetails[i].Quantity__c));
        }
        
        UPDATE ItemDetails;
        
        List <Invoice__c> invoice = new List <Invoice__c>();
        
        for(Invoice__c inv: invoice){
            for(Integer j = 0; j < ItemDetails.size(); j++){
                inv.Name__c = ItemDetails[j].Name;
                inv.Price__c = ItemDetails[j].Price__c;
                inv.Quantity__c = ItemDetails[j].Quantity__c;
                inv.Amount__c = Amount[j];
            }
        }
        
        INSERT invoice;
        
/*        for(Integer j = 0; j < ItemDetails.size(); j++){
            Invoice__c inv = new Invoice__c();
	        inv.Name = Hotel_Menu_Item__c.Name;
        }	*/
        
        PageReference pageRef = new PageReference('/apex/TMSMenuBillPage');
        pageRef.setRedirect(true);
        return pageRef;
        
    }
    
/*    public static PageReference gotoMenu(){
        PageReference pageRef = new PageReference('apex/TMSMenu');
        pageRef.setRedirect(true);
        return pageRef;
    }	*/
    
    public MenuTMS(){
        ItemDetails = [SELECT Id,Name,Price__c,Quantity__c FROM Hotel_Menu_Item__c WHERE Quantity__c != NULL];
		List <Double> Amount = new List <Double> ();
        for(Integer i = 0; i < ItemDetails.size(); ++i){
            Amount.add((ItemDetails[i].Price__c) * (ItemDetails[i].Quantity__c));
        }
        System.debug(ItemDetails);
    }
    
/*    public static void clearList(){
        //Code to clear the Name and price fields.
    } */
    
    public MenuTMS(ApexPages.StandardSetController controller){
        stdSetController = controller;
    }
    
    public MenuTMS(ApexPages.StandardController controller){
        stdController = controller;
    }
    
}

 
<apex:page renderAs="pdf" controller="MenuTMS">
    <center><h1>
        Generated Bill!
        </h1></center>
    <apex:pageBlock>
        <apex:pageBlockSection>
            <apex:outputField value="{! MenuTMS.Name }" />
            <apex:outputField value="{! MenuTMS.Price }" />
            <apex:outputField value="{! MenuTMS.Quantity }" />
            <apex:outputField value="{! MenuTMS.Amount }" />
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>

 
I have defined a Wrapper class inside a Main class.
When I try to use the Constructor of the Wrappe class outside the Wrapper class (except in Main Class Constructor), an error shows up as below:
Constructor not defined: [JSONParserUtil.JSONParserUtilWrapper].<Constructor>()
What can I do, so as to use the Wrapper class's Constructor in other methods of the Main class?
 
<apex:page renderAs="pdf" controller="MenuTMS">
    <center><h1>
        Generated Bill!
        </h1></center>
    <apex:pageBlock>
        <apex:pageBlockSection>
            <apex:outputField value="{! MenuTMS.Name }" />
            <apex:outputField value="{! MenuTMS.Price }" />
            <apex:outputField value="{! MenuTMS.Quantity }" />
            <apex:outputField value="{! MenuTMS.Amount }" />
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>

 
this is my visualforce code...
Actually i want to show the loading image button on click of upload attachment  button
On click of select Attachment the apex method is being called which makes the page to rfresh...
i want to avoid the page refresh...
and rerender cannot be used on <apex:inputfile>
////////visualforce code /////////

<apex:page standardController="Account" extensions="extendAccountforstandardController">
<apex:form id="frm">
<apex:pageBlock >
<apex:pageblockSection >
<apex:inputFile value="{!objAttachment.body}" fileName="{!objAttachment.name}"/> 
</apex:pageblockSection>
<apex:pageBlockButtons >
<apex:commandButton value="Select Attachment" action="{!selectAttachment}" rerender="none" />
</apex:pageBlockButtons>
</apex:pageBlock>
<apex:actionRegion >
<apex:pageBlock id="pgBlkId" >
<apex:pageBlockSection >
<apex:inputField value="{!objAccount.parentid}"/>

</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:outputpanel id="image">
<apex:commandButton action="{!attachRecord}" value=" upload attachment" reRender="image" status="actStatusId" />
</apex:outputpanel>
 <apex:actionStatus id="actStatusId" >
<apex:facet name="start"  >
<img src="/img/loading.gif" />                    
</apex:facet>
</apex:actionStatus> 
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:actionRegion>
</apex:form>
</apex:page>

///// Apex Code

public class extendAccountforstandardController {

    public PageReference attachRecord() {
    
    System.debug('@@objAccount.id'+objAccount.id);
    
     System.debug('@@objAccount.parentId'+objAccount.parentId);
      
      objAttachment.parentId=objAccount.parentId;
      objAttachment.body=bodyAttachment;
      objAttachment.name=nameAttachment;
      
      if(objAccount.parentid!=null){    
        
            insert objAttachment;
        
        }
        return null;
    }

    public blob bodyAttachment;
    
    public string nameAttachment;
    
    public Account objAccount { get; set; }

    public Attachment objAttachment {get; set;}
    
    public extendAccountforstandardController(ApexPages.StandardController controller) {

        objAccount =new Account();
        objAttachment=new Attachment();

    }
    
    public void selectAttachment(){
    bodyAttachment=objAttachment.body;
    nameAttachment=objAttachment.name;
    System.debug(''+'@@nameAttachment'+nameAttachment);
    }
}

 

We would like to create a bar code of the case number. This would then go onto a PDF document that is generated via visualforce.  How do i generate the code to produce the barcode with visualforce and an Apex controller?   Any help or suggestions would be appreciated.