• paras
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 3
    Replies
Hi,
 
I  have a list of type string and have some value in that list . i want those values to be displayed on the page .So i am calling this string list from the page editor :my code goes like this
 
public List<String> getDisplayTags()
{
List<AccountTag> tags= [select Name from AccountTag];
List<String> StringList= new List<String>();
List<AccountTag> finallist= new List<AccountTag>();
   for(Integer j=0;j<tags.size();j++)
   {
   StringList.add(tags[j].Name);
   System.debug('StringList='+StringList);
   }
   System.debug('StringList before sorting='+StringList);
   StringList.sort();
   System.debug('StringList='+StringList);
     for(Integer i=0;i<StringList.size();i++)
      {
     
     
       if(StringList[i]==StringList[i+1])
        {
       
         count=count+1;
         System.debug('Count='+Count);
         if(count>=2)
           {
            UniqueStringList.add(StringList[i]);
            System.debug('UniqueStringList='+UniqueStringList);
           }
        }
     
return UniqueStringList;
      }

      
I am getting an error :
Error: Unknown property 'String.Name'
  • November 25, 2008
  • Like
  • 0
Hi ,
 
I have a requirement as such : i want to to display only those tags on my page which are present for more than two vendors (we have  accounts as vendors ).
 
1.I have taken all the tags in one list
2.then have stored those distinct records in a set (not sure my way is correct or not )
3.created one more list
4.then for each element of the set i am comparing with the elements of set , if i find that element i am incrementing the counter
5. when the counter is greater than 2 , i am storing that tag into list 3 and returning list 2 but
My code goes on like this
 
public List<String> getTags()
{
List<AccountTag> list1= [select Name from AccountTag];
List<AccountTag> list2= new List<AccountTag>();
Set<String> Tags1 = new Set<String>();
List<String> list3 = new List<String>();
for (Integer i=0; i< list1.size(); i++)
{
    Tags1.add(list1[i].name);
}
for(Integer l=0;l<Tags1.size();l++)
{
    list3.add(Tags1[l].name);
}
   for(Integer j=0;j<list3.size();j++)
   {
     for(Integer k=0;k<List1.size();k++)
      {
       if(list1[j]==List3[k])
       count= count+1;
       }
       if(count>=2)
       list2.add(list1[j]);
      }
 
return list2;
}
Unknown property 'String.Name' is the error i am getting
please help : As soon as possible : 


Message Edited by paras on 11-20-2008 08:49 PM

Message Edited by paras on 11-20-2008 08:50 PM
  • November 21, 2008
  • Like
  • 0
Hi ,
 
I have a requirement as such : i want to to display only those tags on my page which are present for more than two vendors (we have  accounts as vendors ). I tried using 2 approach but was not successful
1.i tried getting all the tags in a list of type Sobject(AccountTags) then i ma trying to store those tags to a string list
as i  need to sort them and my code as such :
 
public List<String> getTags()
{
List<AccountTag> list1= [select Name from AccountTag];
List<String> list2= new List<String>();
for(Integer j=0;j<list1.size();j++)
{
System.debug('string='+list1[j].Name);
list2.add(list1[j].Name);
}
list2.sort();
for( Integer i=0;i<list1.size();i++)
{
if(i==0)
{
tempstr=str;
}
else
result=tempstr.compareTo(str);
if(result== 0)
{
list2.add(str);
count++;
}
}
return list2;
}
 
But i am getting an error saying :"
Error: Unknown property 'String.Name";
Please anyone tell me the solution to this problem


Message Edited by paras on 11-20-2008 07:32 PM
  • November 21, 2008
  • Like
  • 0
Hi,
 
I  have a list of type string and have some value in that list . i want those values to be displayed on the page .So i am calling this string list from the page editor :my code goes like this
 
public List<String> getDisplayTags()
{
List<AccountTag> tags= [select Name from AccountTag];
List<String> StringList= new List<String>();
List<AccountTag> finallist= new List<AccountTag>();
   for(Integer j=0;j<tags.size();j++)
   {
   StringList.add(tags[j].Name);
   System.debug('StringList='+StringList);
   }
   System.debug('StringList before sorting='+StringList);
   StringList.sort();
   System.debug('StringList='+StringList);
     for(Integer i=0;i<StringList.size();i++)
      {
     
     
       if(StringList[i]==StringList[i+1])
        {
       
         count=count+1;
         System.debug('Count='+Count);
         if(count>=2)
           {
            UniqueStringList.add(StringList[i]);
            System.debug('UniqueStringList='+UniqueStringList);
           }
        }
     
return UniqueStringList;
      }

      
I am getting an error :
Error: Unknown property 'String.Name'
  • November 25, 2008
  • Like
  • 0
Hi ,
 
I have a requirement as such : i want to to display only those tags on my page which are present for more than two vendors (we have  accounts as vendors ).
 
1.I have taken all the tags in one list
2.then have stored those distinct records in a set (not sure my way is correct or not )
3.created one more list
4.then for each element of the set i am comparing with the elements of set , if i find that element i am incrementing the counter
5. when the counter is greater than 2 , i am storing that tag into list 3 and returning list 2 but
My code goes on like this
 
public List<String> getTags()
{
List<AccountTag> list1= [select Name from AccountTag];
List<AccountTag> list2= new List<AccountTag>();
Set<String> Tags1 = new Set<String>();
List<String> list3 = new List<String>();
for (Integer i=0; i< list1.size(); i++)
{
    Tags1.add(list1[i].name);
}
for(Integer l=0;l<Tags1.size();l++)
{
    list3.add(Tags1[l].name);
}
   for(Integer j=0;j<list3.size();j++)
   {
     for(Integer k=0;k<List1.size();k++)
      {
       if(list1[j]==List3[k])
       count= count+1;
       }
       if(count>=2)
       list2.add(list1[j]);
      }
 
return list2;
}
Unknown property 'String.Name' is the error i am getting
please help : As soon as possible : 


Message Edited by paras on 11-20-2008 08:49 PM

Message Edited by paras on 11-20-2008 08:50 PM
  • November 21, 2008
  • Like
  • 0