You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by nalin chandra <na...@palindromesoftware.com> on 2008/12/02 21:35:33 UTC

CSV reporting..

i use CSV reporting in ofbiz

As we all know, we can display data of only one list in the form.

so i use view entity to display data of multiple table.
now i have one problem.

i want to display the detail of party like name, address, email, contact
number etc.
for this purpose i create a view entity but it only display the email id or
telephone number because contactMechId id different for those two, so please
help me on this issue..

below i paste the view entity code which i use for this purpose:-

DynamicViewEntity dynamicView = new DynamicViewEntity();
List orderBy = FastList.newInstance();
List fieldsToSelect = FastList.newInstance();

dynamicView.addMemberEntity("PT", "Party");
dynamicView.addAlias("PT", "partyId");
dynamicView.addAlias("PT", "statusId");
dynamicView.addAlias("PT", "partyTypeId");
dynamicView.addAlias("PT", "createdDate");
dynamicView.addRelation("one-nofk", "", "PartyType",
ModelKeyMap.makeKeyMapList("partyTypeId"));
dynamicView.addRelation("many", "", "UserLogin",
ModelKeyMap.makeKeyMapList("partyId"));


fieldsToSelect.add("partyId");
fieldsToSelect.add("statusId");
fieldsToSelect.add("partyTypeId");
fieldsToSelect.add("createdDate");
orderBy.add("createdDate");

dynamicView.addMemberEntity("PDS", "PartyDataSource");
dynamicView.addAlias("PDS", "visitId");
dynamicView.addViewLink("PT", "PDS", Boolean.FALSE,
ModelKeyMap.makeKeyMapList("partyId"));

fieldsToSelect.add("visitId");

dynamicView.addMemberEntity("UL", "UserLogin");
dynamicView.addAlias("UL", "userLoginId");
dynamicView.addViewLink("PT", "UL", Boolean.FALSE,
ModelKeyMap.makeKeyMapList("partyId"));

fieldsToSelect.add("userLoginId");

dynamicView.addMemberEntity("PE", "Person");
dynamicView.addAlias("PE", "firstName");
dynamicView.addAlias("PE", "lastName");
dynamicView.addViewLink("PT", "PE", Boolean.FALSE,
ModelKeyMap.makeKeyMapList("partyId"));

fieldsToSelect.add("firstName");
fieldsToSelect.add("lastName");

dynamicView.addMemberEntity("PC", "PartyContactMech");
dynamicView.addMemberEntity("CM", "ContactMech");
dynamicView.addMemberEntity("TM", "TelecomNumber");
dynamicView.addAlias("PC", "contactMechId");
dynamicView.addAlias("CM", "infoString");
dynamicView.addAlias("TM", "countryCode");
dynamicView.addAlias("TM", "areaCode");
dynamicView.addAlias("TM", "contactNumber");
dynamicView.addViewLink("PT", "PC", Boolean.FALSE,
ModelKeyMap.makeKeyMapList("partyId"));
dynamicView.addViewLink("PC", "CM", Boolean.FALSE,
ModelKeyMap.makeKeyMapList("contactMechId"));
dynamicView.addViewLink("PC", "TM", Boolean.FALSE,
ModelKeyMap.makeKeyMapList("contactMechId"));

fieldsToSelect.add("infoString");
fieldsToSelect.add("contactNumber");
fieldsToSelect.add("areaCode");
fieldsToSelect.add("countryCode");


in ftl file if i display partyLists.infoSting is display null because for
telecomNumber there is no infoString value in corresponding column of 
contactMech table.

-- 
View this message in context: http://www.nabble.com/CSV-reporting..-tp20800340p20800340.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: CSV reporting..

Posted by nalin chandra <na...@palindromesoftware.com>.
Thanks for suggestion....


BJ Freeman wrote:
> 
> my first suggestion is you make a view-entity in a xml file
> and include it in your project.
> then you can use web tools to look at it like anyother entity.
> https://demo.hotwaxmedia.com/webtools/control/FindGeneric?entityName=ContactMechDetail&find=true&VIEW_SIZE=50&VIEW_INDEX=0
> 
> you should have a _NA_ for fields instead of Nulls where there is a
> relationship.
> 
> 
> nalin chandra sent the following on 12/2/2008 12:35 PM:
>> i use CSV reporting in ofbiz
>> 
>> As we all know, we can display data of only one list in the form.
>> 
>> so i use view entity to display data of multiple table.
>> now i have one problem.
>> 
>> i want to display the detail of party like name, address, email, contact
>> number etc.
>> for this purpose i create a view entity but it only display the email id
>> or
>> telephone number because contactMechId id different for those two, so
>> please
>> help me on this issue..
>> 
>> below i paste the view entity code which i use for this purpose:-
>> 
>> DynamicViewEntity dynamicView = new DynamicViewEntity();
>> List orderBy = FastList.newInstance();
>> List fieldsToSelect = FastList.newInstance();
>> 
>> dynamicView.addMemberEntity("PT", "Party");
>> dynamicView.addAlias("PT", "partyId");
>> dynamicView.addAlias("PT", "statusId");
>> dynamicView.addAlias("PT", "partyTypeId");
>> dynamicView.addAlias("PT", "createdDate");
>> dynamicView.addRelation("one-nofk", "", "PartyType",
>> ModelKeyMap.makeKeyMapList("partyTypeId"));
>> dynamicView.addRelation("many", "", "UserLogin",
>> ModelKeyMap.makeKeyMapList("partyId"));
>> 
>> 
>> fieldsToSelect.add("partyId");
>> fieldsToSelect.add("statusId");
>> fieldsToSelect.add("partyTypeId");
>> fieldsToSelect.add("createdDate");
>> orderBy.add("createdDate");
>> 
>> dynamicView.addMemberEntity("PDS", "PartyDataSource");
>> dynamicView.addAlias("PDS", "visitId");
>> dynamicView.addViewLink("PT", "PDS", Boolean.FALSE,
>> ModelKeyMap.makeKeyMapList("partyId"));
>> 
>> fieldsToSelect.add("visitId");
>> 
>> dynamicView.addMemberEntity("UL", "UserLogin");
>> dynamicView.addAlias("UL", "userLoginId");
>> dynamicView.addViewLink("PT", "UL", Boolean.FALSE,
>> ModelKeyMap.makeKeyMapList("partyId"));
>> 
>> fieldsToSelect.add("userLoginId");
>> 
>> dynamicView.addMemberEntity("PE", "Person");
>> dynamicView.addAlias("PE", "firstName");
>> dynamicView.addAlias("PE", "lastName");
>> dynamicView.addViewLink("PT", "PE", Boolean.FALSE,
>> ModelKeyMap.makeKeyMapList("partyId"));
>> 
>> fieldsToSelect.add("firstName");
>> fieldsToSelect.add("lastName");
>> 
>> dynamicView.addMemberEntity("PC", "PartyContactMech");
>> dynamicView.addMemberEntity("CM", "ContactMech");
>> dynamicView.addMemberEntity("TM", "TelecomNumber");
>> dynamicView.addAlias("PC", "contactMechId");
>> dynamicView.addAlias("CM", "infoString");
>> dynamicView.addAlias("TM", "countryCode");
>> dynamicView.addAlias("TM", "areaCode");
>> dynamicView.addAlias("TM", "contactNumber");
>> dynamicView.addViewLink("PT", "PC", Boolean.FALSE,
>> ModelKeyMap.makeKeyMapList("partyId"));
>> dynamicView.addViewLink("PC", "CM", Boolean.FALSE,
>> ModelKeyMap.makeKeyMapList("contactMechId"));
>> dynamicView.addViewLink("PC", "TM", Boolean.FALSE,
>> ModelKeyMap.makeKeyMapList("contactMechId"));
>> 
>> fieldsToSelect.add("infoString");
>> fieldsToSelect.add("contactNumber");
>> fieldsToSelect.add("areaCode");
>> fieldsToSelect.add("countryCode");
>> 
>> 
>> in ftl file if i display partyLists.infoSting is display null because for
>> telecomNumber there is no infoString value in corresponding column of 
>> contactMech table.
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/CSV-reporting..-tp20800340p20800983.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: CSV reporting..

Posted by BJ Freeman <bj...@free-man.net>.
my first suggestion is you make a view-entity in a xml file
and include it in your project.
then you can use web tools to look at it like anyother entity.
https://demo.hotwaxmedia.com/webtools/control/FindGeneric?entityName=ContactMechDetail&find=true&VIEW_SIZE=50&VIEW_INDEX=0

you should have a _NA_ for fields instead of Nulls where there is a
relationship.


nalin chandra sent the following on 12/2/2008 12:35 PM:
> i use CSV reporting in ofbiz
> 
> As we all know, we can display data of only one list in the form.
> 
> so i use view entity to display data of multiple table.
> now i have one problem.
> 
> i want to display the detail of party like name, address, email, contact
> number etc.
> for this purpose i create a view entity but it only display the email id or
> telephone number because contactMechId id different for those two, so please
> help me on this issue..
> 
> below i paste the view entity code which i use for this purpose:-
> 
> DynamicViewEntity dynamicView = new DynamicViewEntity();
> List orderBy = FastList.newInstance();
> List fieldsToSelect = FastList.newInstance();
> 
> dynamicView.addMemberEntity("PT", "Party");
> dynamicView.addAlias("PT", "partyId");
> dynamicView.addAlias("PT", "statusId");
> dynamicView.addAlias("PT", "partyTypeId");
> dynamicView.addAlias("PT", "createdDate");
> dynamicView.addRelation("one-nofk", "", "PartyType",
> ModelKeyMap.makeKeyMapList("partyTypeId"));
> dynamicView.addRelation("many", "", "UserLogin",
> ModelKeyMap.makeKeyMapList("partyId"));
> 
> 
> fieldsToSelect.add("partyId");
> fieldsToSelect.add("statusId");
> fieldsToSelect.add("partyTypeId");
> fieldsToSelect.add("createdDate");
> orderBy.add("createdDate");
> 
> dynamicView.addMemberEntity("PDS", "PartyDataSource");
> dynamicView.addAlias("PDS", "visitId");
> dynamicView.addViewLink("PT", "PDS", Boolean.FALSE,
> ModelKeyMap.makeKeyMapList("partyId"));
> 
> fieldsToSelect.add("visitId");
> 
> dynamicView.addMemberEntity("UL", "UserLogin");
> dynamicView.addAlias("UL", "userLoginId");
> dynamicView.addViewLink("PT", "UL", Boolean.FALSE,
> ModelKeyMap.makeKeyMapList("partyId"));
> 
> fieldsToSelect.add("userLoginId");
> 
> dynamicView.addMemberEntity("PE", "Person");
> dynamicView.addAlias("PE", "firstName");
> dynamicView.addAlias("PE", "lastName");
> dynamicView.addViewLink("PT", "PE", Boolean.FALSE,
> ModelKeyMap.makeKeyMapList("partyId"));
> 
> fieldsToSelect.add("firstName");
> fieldsToSelect.add("lastName");
> 
> dynamicView.addMemberEntity("PC", "PartyContactMech");
> dynamicView.addMemberEntity("CM", "ContactMech");
> dynamicView.addMemberEntity("TM", "TelecomNumber");
> dynamicView.addAlias("PC", "contactMechId");
> dynamicView.addAlias("CM", "infoString");
> dynamicView.addAlias("TM", "countryCode");
> dynamicView.addAlias("TM", "areaCode");
> dynamicView.addAlias("TM", "contactNumber");
> dynamicView.addViewLink("PT", "PC", Boolean.FALSE,
> ModelKeyMap.makeKeyMapList("partyId"));
> dynamicView.addViewLink("PC", "CM", Boolean.FALSE,
> ModelKeyMap.makeKeyMapList("contactMechId"));
> dynamicView.addViewLink("PC", "TM", Boolean.FALSE,
> ModelKeyMap.makeKeyMapList("contactMechId"));
> 
> fieldsToSelect.add("infoString");
> fieldsToSelect.add("contactNumber");
> fieldsToSelect.add("areaCode");
> fieldsToSelect.add("countryCode");
> 
> 
> in ftl file if i display partyLists.infoSting is display null because for
> telecomNumber there is no infoString value in corresponding column of 
> contactMech table.
> 

Re: CSV reporting..

Posted by Jacques Le Roux <ja...@les7arts.com>.
Done, I quickly reformated the code
http://docs.ofbiz.org/display/OFBIZ/FAQ+-+Tips+-+Tricks+-+Cookbook+-+HowTo#FAQ-Tips-Tricks-Cookbook-HowTo-Miscellaneous

Jacques

From: "BJ Freeman" <bj...@free-man.net>
> you can put this in the FAQ tips and tricks wiki.
> http://docs.ofbiz.org/display/OFBIZ/FAQ+-+Tips+-+Tricks+-+Cookbook+-+HowTo
> 
> S K Pradeep kumar sent the following on 12/3/2008 1:44 AM:
>> Hi,
>> 
>> I think this code will helpful for you
>> 
>> /*
>>  * Licensed to the Apache Software Foundation (ASF) under one
>>  * or more contributor license agreements.  See the NOTICE file
>>  * distributed with this work for additional information
>>  * regarding copyright ownership.  The ASF licenses this file
>>  * to you under the Apache License, Version 2.0 (the
>>  * "License"); you may not use this file except in compliance
>>  * with the License.  You may obtain a copy of the License at
>>  *
>>  * http://www.apache.org/licenses/LICENSE-2.0
>>  *
>>  * Unless required by applicable law or agreed to in writing,
>>  * software distributed under the License is distributed on an
>>  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>  * KIND, either express or implied.  See the License for the
>>  * specific language governing permissions and limitations
>>  * under the License.
>>  */
>> 
>> import java.util.*;
>> import org.ofbiz.entity.*;
>> import org.ofbiz.entity.util.EntityUtil;
>> import org.ofbiz.base.util.*;
>> import org.ofbiz.securityext.login.*;
>> import org.ofbiz.common.*;
>> 
>> import org.ofbiz.party.contact.*;
>> import org.ofbiz.party.party.*;
>> import org.ofbiz.accounting.payment.*;
>> import org.ofbiz.securityext.login.*;
>> 
>> 
>> if(partyList != null)
>> {
>>  partyListIt = partyList.iterator();
>> FileWriter fw = new FileWriter("E:\\RAF02Nov\\skp.csv");
>>       fw.append("partyId");
>>       fw.append(',');
>>       fw.append("toName");
>>       fw.append(',');
>>       fw.append("attnName");
>>       fw.append(',');
>>       fw.append("Address1");
>>       fw.append(',');
>>       fw.append("Address2");
>>       fw.append(',');
>>       fw.append("City");
>>       fw.append(',');
>>       fw.append("PostalCode");
>>       fw.append(',');
>>       fw.append("State");
>>       fw.append(',');
>>       fw.append("Country");
>>       fw.append(',');
>>       fw.append("Full Name");
>>       fw.append('\n');
>>     while(partyListIt.hasNext())
>>     {
>>         fullName = "";
>>         toName = "";
>>         attnName ="";
>>         address1 = "";
>>         address2 = "";
>>         city = "";
>>         state= "";
>>         country = "";
>>         postalCode = "";
>>         email = "";
>>         phone ="";
>>         genericPartyList = partyListIt.next();
>>         partyId = genericPartyList.getString("partyId");
>> 
>>         List partyContactMechValueMaps =
>> ContactMechWorker.getPartyContactMechValueMaps(delegator, partyId, false);
>>         Iterator contactMechIt = partyContactMechValueMaps.iterator();
>>          while(contactMechIt.hasNext())
>>          {
>>               contactMechGV = contactMechIt.next();
>>               otherValues = PartyWorker.getPartyOtherValues(request,
>> partyId, "party", "lookupPerson", "lookupGroup");
>>               lookupPerson = otherValues.get("lookupPerson");
>> 
>>               if(lookupPerson != null)
>>               {
>>                 if(lookupPerson.get("firstName") != null)
>>                  fullName += lookupPerson.get("firstName");
>>                 if(lookupPerson.get("middleName") != null)
>>                  fullName +=" "+lookupPerson.get("middleName");
>>                 if(lookupPerson.get("lastName") != null)
>>                  fullName +=" "+lookupPerson.get("lastName");
>>                 if(lookupPerson.get("suffix") != null)
>>                  fullName +=" "+lookupPerson.get("suffix");
>>               }
>>               else
>>               {
>>                  fullName += " ";
>>               }
>>               contactMech1 = contactMechGV.get("contactMech");
>> 
>> if("POSTAL_ADDRESS".equals(contactMech1.getString("contactMechTypeId")))
>>               {
>>                 postalAddress = contactMechGV.get("postalAddress");
>>                 if( postalAddress.get("toName") != null)
>>                  {
>>                      toName += postalAddress.get("toName").replace(","," ");
>>                  }
>>                  if(postalAddress.get("attnName") != null)
>>                  {
>>                     attnName += "
>> "+postalAddress.get("attnName").replace(","," ");
>>                  }
>>                  address1 +=" "+postalAddress.get("address1").replace(",","
>> ");
>>                  if(postalAddress.get("address2") != null)
>>                  {
>>                     address2 += "
>> "+postalAddress.get("address2").replace(","," ");
>>                  }
>>                  city +=" "+postalAddress.get("city").replace(","," ");
>>                  postalCode += "
>> "+postalAddress.get("postalCode").replace(","," ");
>>                  if(postalAddress.get("stateProvinceGeoId") != null)
>>                  {
>>                     state +="
>> "+postalAddress.getRelatedOneCache("StateProvinceGeo").get("abbreviation").replace(",","
>> ");
>>                  }
>>                  if(postalAddress.get("countryGeoId") != null)
>>                  {
>>                     country +="
>> "+postalAddress.getRelatedOneCache("CountryGeo").get("geoName").replace(",","
>> ");
>>                  }
>>               }
>> 
>> if("EMAIL_ADDRESS".equals(contactMech1.getString("contactMechTypeId")))
>>               {
>>                     email += contactMech1.getString("infoString")+"/";
>>               }
>> 
>> if("TELECOM_NUMBER".equals(contactMech1.getString("contactMechTypeId")))
>>               {
>>                     telecomNumber = contactMechGV.get("telecomNumber");
>>                     if(telecomNumber.get("areaCode") != null)
>>                         phone += telecomNumber.get("areaCode").trim();
>> 
>>                       phone += telecomNumber.get("contactNumber").trim();
>> 
>>                    // if(telecomNumber.partyContactMech.get("extension") !=
>> null)
>>                     // phone +=
>> telecomNumber.partyContactMech.get("extension");
>>               }
>>              // print(" partyId "+partyId+" email "+email+" fullName
>> "+fullName+" address "+address+" phone "+phone);
>>         }
>>         fw.append(partyId);
>>         fw.append(',');
>>         fw.append(toName);
>>           fw.append(',');
>>           fw.append(attnName);
>>           fw.append(',');
>>         fw.append(address1);
>>           fw.append(',');
>>         fw.append(address2);
>>           fw.append(',');
>>           fw.append(city);
>>           fw.append(',');
>>           fw.append(postalCode);
>>           fw.append(',');
>>           fw.append(state);
>>           fw.append(',');
>>           fw.append(country);
>>           fw.append(',');
>>           fw.append(fullName);
>>         fw.append('\n');
>> 
>>       fw.flush();
>>      // fw.close();
>>       //response.sendRedirect("control/main");
>>     }
>> }
>> 
>> 
>> 
>> 
>> 
>> 
>> On Wed, Dec 3, 2008 at 2:05 AM, nalin chandra <
>> nalin.chandra@palindromesoftware.com> wrote:
>> 
>>> i use CSV reporting in ofbiz
>>>
>>> As we all know, we can display data of only one list in the form.
>>>
>>> so i use view entity to display data of multiple table.
>>> now i have one problem.
>>>
>>> i want to display the detail of party like name, address, email, contact
>>> number etc.
>>> for this purpose i create a view entity but it only display the email id or
>>> telephone number because contactMechId id different for those two, so
>>> please
>>> help me on this issue..
>>>
>>> below i paste the view entity code which i use for this purpose:-
>>>
>>> DynamicViewEntity dynamicView = new DynamicViewEntity();
>>> List orderBy = FastList.newInstance();
>>> List fieldsToSelect = FastList.newInstance();
>>>
>>> dynamicView.addMemberEntity("PT", "Party");
>>> dynamicView.addAlias("PT", "partyId");
>>> dynamicView.addAlias("PT", "statusId");
>>> dynamicView.addAlias("PT", "partyTypeId");
>>> dynamicView.addAlias("PT", "createdDate");
>>> dynamicView.addRelation("one-nofk", "", "PartyType",
>>> ModelKeyMap.makeKeyMapList("partyTypeId"));
>>> dynamicView.addRelation("many", "", "UserLogin",
>>> ModelKeyMap.makeKeyMapList("partyId"));
>>>
>>>
>>> fieldsToSelect.add("partyId");
>>> fieldsToSelect.add("statusId");
>>> fieldsToSelect.add("partyTypeId");
>>> fieldsToSelect.add("createdDate");
>>> orderBy.add("createdDate");
>>>
>>> dynamicView.addMemberEntity("PDS", "PartyDataSource");
>>> dynamicView.addAlias("PDS", "visitId");
>>> dynamicView.addViewLink("PT", "PDS", Boolean.FALSE,
>>> ModelKeyMap.makeKeyMapList("partyId"));
>>>
>>> fieldsToSelect.add("visitId");
>>>
>>> dynamicView.addMemberEntity("UL", "UserLogin");
>>> dynamicView.addAlias("UL", "userLoginId");
>>> dynamicView.addViewLink("PT", "UL", Boolean.FALSE,
>>> ModelKeyMap.makeKeyMapList("partyId"));
>>>
>>> fieldsToSelect.add("userLoginId");
>>>
>>> dynamicView.addMemberEntity("PE", "Person");
>>> dynamicView.addAlias("PE", "firstName");
>>> dynamicView.addAlias("PE", "lastName");
>>> dynamicView.addViewLink("PT", "PE", Boolean.FALSE,
>>> ModelKeyMap.makeKeyMapList("partyId"));
>>>
>>> fieldsToSelect.add("firstName");
>>> fieldsToSelect.add("lastName");
>>>
>>> dynamicView.addMemberEntity("PC", "PartyContactMech");
>>> dynamicView.addMemberEntity("CM", "ContactMech");
>>> dynamicView.addMemberEntity("TM", "TelecomNumber");
>>> dynamicView.addAlias("PC", "contactMechId");
>>> dynamicView.addAlias("CM", "infoString");
>>> dynamicView.addAlias("TM", "countryCode");
>>> dynamicView.addAlias("TM", "areaCode");
>>> dynamicView.addAlias("TM", "contactNumber");
>>> dynamicView.addViewLink("PT", "PC", Boolean.FALSE,
>>> ModelKeyMap.makeKeyMapList("partyId"));
>>> dynamicView.addViewLink("PC", "CM", Boolean.FALSE,
>>> ModelKeyMap.makeKeyMapList("contactMechId"));
>>> dynamicView.addViewLink("PC", "TM", Boolean.FALSE,
>>> ModelKeyMap.makeKeyMapList("contactMechId"));
>>>
>>> fieldsToSelect.add("infoString");
>>> fieldsToSelect.add("contactNumber");
>>> fieldsToSelect.add("areaCode");
>>> fieldsToSelect.add("countryCode");
>>>
>>>
>>> in ftl file if i display partyLists.infoSting is display null because for
>>> telecomNumber there is no infoString value in corresponding column of
>>> contactMech table.
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/CSV-reporting..-tp20800340p20800340.html
>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>
>>>
>> 
>> 
>

Re: CSV reporting..

Posted by BJ Freeman <bj...@free-man.net>.
you can put this in the FAQ tips and tricks wiki.
http://docs.ofbiz.org/display/OFBIZ/FAQ+-+Tips+-+Tricks+-+Cookbook+-+HowTo

S K Pradeep kumar sent the following on 12/3/2008 1:44 AM:
> Hi,
> 
> I think this code will helpful for you
> 
> /*
>  * Licensed to the Apache Software Foundation (ASF) under one
>  * or more contributor license agreements.  See the NOTICE file
>  * distributed with this work for additional information
>  * regarding copyright ownership.  The ASF licenses this file
>  * to you under the Apache License, Version 2.0 (the
>  * "License"); you may not use this file except in compliance
>  * with the License.  You may obtain a copy of the License at
>  *
>  * http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing,
>  * software distributed under the License is distributed on an
>  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>  * KIND, either express or implied.  See the License for the
>  * specific language governing permissions and limitations
>  * under the License.
>  */
> 
> import java.util.*;
> import org.ofbiz.entity.*;
> import org.ofbiz.entity.util.EntityUtil;
> import org.ofbiz.base.util.*;
> import org.ofbiz.securityext.login.*;
> import org.ofbiz.common.*;
> 
> import org.ofbiz.party.contact.*;
> import org.ofbiz.party.party.*;
> import org.ofbiz.accounting.payment.*;
> import org.ofbiz.securityext.login.*;
> 
> 
> if(partyList != null)
> {
>  partyListIt = partyList.iterator();
> FileWriter fw = new FileWriter("E:\\RAF02Nov\\skp.csv");
>       fw.append("partyId");
>       fw.append(',');
>       fw.append("toName");
>       fw.append(',');
>       fw.append("attnName");
>       fw.append(',');
>       fw.append("Address1");
>       fw.append(',');
>       fw.append("Address2");
>       fw.append(',');
>       fw.append("City");
>       fw.append(',');
>       fw.append("PostalCode");
>       fw.append(',');
>       fw.append("State");
>       fw.append(',');
>       fw.append("Country");
>       fw.append(',');
>       fw.append("Full Name");
>       fw.append('\n');
>     while(partyListIt.hasNext())
>     {
>         fullName = "";
>         toName = "";
>         attnName ="";
>         address1 = "";
>         address2 = "";
>         city = "";
>         state= "";
>         country = "";
>         postalCode = "";
>         email = "";
>         phone ="";
>         genericPartyList = partyListIt.next();
>         partyId = genericPartyList.getString("partyId");
> 
>         List partyContactMechValueMaps =
> ContactMechWorker.getPartyContactMechValueMaps(delegator, partyId, false);
>         Iterator contactMechIt = partyContactMechValueMaps.iterator();
>          while(contactMechIt.hasNext())
>          {
>               contactMechGV = contactMechIt.next();
>               otherValues = PartyWorker.getPartyOtherValues(request,
> partyId, "party", "lookupPerson", "lookupGroup");
>               lookupPerson = otherValues.get("lookupPerson");
> 
>               if(lookupPerson != null)
>               {
>                 if(lookupPerson.get("firstName") != null)
>                  fullName += lookupPerson.get("firstName");
>                 if(lookupPerson.get("middleName") != null)
>                  fullName +=" "+lookupPerson.get("middleName");
>                 if(lookupPerson.get("lastName") != null)
>                  fullName +=" "+lookupPerson.get("lastName");
>                 if(lookupPerson.get("suffix") != null)
>                  fullName +=" "+lookupPerson.get("suffix");
>               }
>               else
>               {
>                  fullName += " ";
>               }
>               contactMech1 = contactMechGV.get("contactMech");
> 
> if("POSTAL_ADDRESS".equals(contactMech1.getString("contactMechTypeId")))
>               {
>                 postalAddress = contactMechGV.get("postalAddress");
>                 if( postalAddress.get("toName") != null)
>                  {
>                      toName += postalAddress.get("toName").replace(","," ");
>                  }
>                  if(postalAddress.get("attnName") != null)
>                  {
>                     attnName += "
> "+postalAddress.get("attnName").replace(","," ");
>                  }
>                  address1 +=" "+postalAddress.get("address1").replace(",","
> ");
>                  if(postalAddress.get("address2") != null)
>                  {
>                     address2 += "
> "+postalAddress.get("address2").replace(","," ");
>                  }
>                  city +=" "+postalAddress.get("city").replace(","," ");
>                  postalCode += "
> "+postalAddress.get("postalCode").replace(","," ");
>                  if(postalAddress.get("stateProvinceGeoId") != null)
>                  {
>                     state +="
> "+postalAddress.getRelatedOneCache("StateProvinceGeo").get("abbreviation").replace(",","
> ");
>                  }
>                  if(postalAddress.get("countryGeoId") != null)
>                  {
>                     country +="
> "+postalAddress.getRelatedOneCache("CountryGeo").get("geoName").replace(",","
> ");
>                  }
>               }
> 
> if("EMAIL_ADDRESS".equals(contactMech1.getString("contactMechTypeId")))
>               {
>                     email += contactMech1.getString("infoString")+"/";
>               }
> 
> if("TELECOM_NUMBER".equals(contactMech1.getString("contactMechTypeId")))
>               {
>                     telecomNumber = contactMechGV.get("telecomNumber");
>                     if(telecomNumber.get("areaCode") != null)
>                         phone += telecomNumber.get("areaCode").trim();
> 
>                       phone += telecomNumber.get("contactNumber").trim();
> 
>                    // if(telecomNumber.partyContactMech.get("extension") !=
> null)
>                     // phone +=
> telecomNumber.partyContactMech.get("extension");
>               }
>              // print(" partyId "+partyId+" email "+email+" fullName
> "+fullName+" address "+address+" phone "+phone);
>         }
>         fw.append(partyId);
>         fw.append(',');
>         fw.append(toName);
>           fw.append(',');
>           fw.append(attnName);
>           fw.append(',');
>         fw.append(address1);
>           fw.append(',');
>         fw.append(address2);
>           fw.append(',');
>           fw.append(city);
>           fw.append(',');
>           fw.append(postalCode);
>           fw.append(',');
>           fw.append(state);
>           fw.append(',');
>           fw.append(country);
>           fw.append(',');
>           fw.append(fullName);
>         fw.append('\n');
> 
>       fw.flush();
>      // fw.close();
>       //response.sendRedirect("control/main");
>     }
> }
> 
> 
> 
> 
> 
> 
> On Wed, Dec 3, 2008 at 2:05 AM, nalin chandra <
> nalin.chandra@palindromesoftware.com> wrote:
> 
>> i use CSV reporting in ofbiz
>>
>> As we all know, we can display data of only one list in the form.
>>
>> so i use view entity to display data of multiple table.
>> now i have one problem.
>>
>> i want to display the detail of party like name, address, email, contact
>> number etc.
>> for this purpose i create a view entity but it only display the email id or
>> telephone number because contactMechId id different for those two, so
>> please
>> help me on this issue..
>>
>> below i paste the view entity code which i use for this purpose:-
>>
>> DynamicViewEntity dynamicView = new DynamicViewEntity();
>> List orderBy = FastList.newInstance();
>> List fieldsToSelect = FastList.newInstance();
>>
>> dynamicView.addMemberEntity("PT", "Party");
>> dynamicView.addAlias("PT", "partyId");
>> dynamicView.addAlias("PT", "statusId");
>> dynamicView.addAlias("PT", "partyTypeId");
>> dynamicView.addAlias("PT", "createdDate");
>> dynamicView.addRelation("one-nofk", "", "PartyType",
>> ModelKeyMap.makeKeyMapList("partyTypeId"));
>> dynamicView.addRelation("many", "", "UserLogin",
>> ModelKeyMap.makeKeyMapList("partyId"));
>>
>>
>> fieldsToSelect.add("partyId");
>> fieldsToSelect.add("statusId");
>> fieldsToSelect.add("partyTypeId");
>> fieldsToSelect.add("createdDate");
>> orderBy.add("createdDate");
>>
>> dynamicView.addMemberEntity("PDS", "PartyDataSource");
>> dynamicView.addAlias("PDS", "visitId");
>> dynamicView.addViewLink("PT", "PDS", Boolean.FALSE,
>> ModelKeyMap.makeKeyMapList("partyId"));
>>
>> fieldsToSelect.add("visitId");
>>
>> dynamicView.addMemberEntity("UL", "UserLogin");
>> dynamicView.addAlias("UL", "userLoginId");
>> dynamicView.addViewLink("PT", "UL", Boolean.FALSE,
>> ModelKeyMap.makeKeyMapList("partyId"));
>>
>> fieldsToSelect.add("userLoginId");
>>
>> dynamicView.addMemberEntity("PE", "Person");
>> dynamicView.addAlias("PE", "firstName");
>> dynamicView.addAlias("PE", "lastName");
>> dynamicView.addViewLink("PT", "PE", Boolean.FALSE,
>> ModelKeyMap.makeKeyMapList("partyId"));
>>
>> fieldsToSelect.add("firstName");
>> fieldsToSelect.add("lastName");
>>
>> dynamicView.addMemberEntity("PC", "PartyContactMech");
>> dynamicView.addMemberEntity("CM", "ContactMech");
>> dynamicView.addMemberEntity("TM", "TelecomNumber");
>> dynamicView.addAlias("PC", "contactMechId");
>> dynamicView.addAlias("CM", "infoString");
>> dynamicView.addAlias("TM", "countryCode");
>> dynamicView.addAlias("TM", "areaCode");
>> dynamicView.addAlias("TM", "contactNumber");
>> dynamicView.addViewLink("PT", "PC", Boolean.FALSE,
>> ModelKeyMap.makeKeyMapList("partyId"));
>> dynamicView.addViewLink("PC", "CM", Boolean.FALSE,
>> ModelKeyMap.makeKeyMapList("contactMechId"));
>> dynamicView.addViewLink("PC", "TM", Boolean.FALSE,
>> ModelKeyMap.makeKeyMapList("contactMechId"));
>>
>> fieldsToSelect.add("infoString");
>> fieldsToSelect.add("contactNumber");
>> fieldsToSelect.add("areaCode");
>> fieldsToSelect.add("countryCode");
>>
>>
>> in ftl file if i display partyLists.infoSting is display null because for
>> telecomNumber there is no infoString value in corresponding column of
>> contactMech table.
>>
>> --
>> View this message in context:
>> http://www.nabble.com/CSV-reporting..-tp20800340p20800340.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>>
> 
> 

Re: CSV reporting..

Posted by nalin chandra <na...@palindromesoftware.com>.
hi..

thanks for your contribution ..

but main things is how to prepare the partyList

your code is good but it display the all information of single party, but i
want to display the list of party registered with us in certain time period
with their detail.

i think now you understand my problem.



S K Pradeep kumar wrote:
> 
> Hi,
> 
> I think this code will helpful for you
> 
> /*
>  * Licensed to the Apache Software Foundation (ASF) under one
>  * or more contributor license agreements.  See the NOTICE file
>  * distributed with this work for additional information
>  * regarding copyright ownership.  The ASF licenses this file
>  * to you under the Apache License, Version 2.0 (the
>  * "License"); you may not use this file except in compliance
>  * with the License.  You may obtain a copy of the License at
>  *
>  * http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing,
>  * software distributed under the License is distributed on an
>  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>  * KIND, either express or implied.  See the License for the
>  * specific language governing permissions and limitations
>  * under the License.
>  */
> 
> import java.util.*;
> import org.ofbiz.entity.*;
> import org.ofbiz.entity.util.EntityUtil;
> import org.ofbiz.base.util.*;
> import org.ofbiz.securityext.login.*;
> import org.ofbiz.common.*;
> 
> import org.ofbiz.party.contact.*;
> import org.ofbiz.party.party.*;
> import org.ofbiz.accounting.payment.*;
> import org.ofbiz.securityext.login.*;
> 
> 
> if(partyList != null)
> {
>  partyListIt = partyList.iterator();
> FileWriter fw = new FileWriter("E:\\RAF02Nov\\skp.csv");
>       fw.append("partyId");
>       fw.append(',');
>       fw.append("toName");
>       fw.append(',');
>       fw.append("attnName");
>       fw.append(',');
>       fw.append("Address1");
>       fw.append(',');
>       fw.append("Address2");
>       fw.append(',');
>       fw.append("City");
>       fw.append(',');
>       fw.append("PostalCode");
>       fw.append(',');
>       fw.append("State");
>       fw.append(',');
>       fw.append("Country");
>       fw.append(',');
>       fw.append("Full Name");
>       fw.append('\n');
>     while(partyListIt.hasNext())
>     {
>         fullName = "";
>         toName = "";
>         attnName ="";
>         address1 = "";
>         address2 = "";
>         city = "";
>         state= "";
>         country = "";
>         postalCode = "";
>         email = "";
>         phone ="";
>         genericPartyList = partyListIt.next();
>         partyId = genericPartyList.getString("partyId");
> 
>         List partyContactMechValueMaps =
> ContactMechWorker.getPartyContactMechValueMaps(delegator, partyId, false);
>         Iterator contactMechIt = partyContactMechValueMaps.iterator();
>          while(contactMechIt.hasNext())
>          {
>               contactMechGV = contactMechIt.next();
>               otherValues = PartyWorker.getPartyOtherValues(request,
> partyId, "party", "lookupPerson", "lookupGroup");
>               lookupPerson = otherValues.get("lookupPerson");
> 
>               if(lookupPerson != null)
>               {
>                 if(lookupPerson.get("firstName") != null)
>                  fullName += lookupPerson.get("firstName");
>                 if(lookupPerson.get("middleName") != null)
>                  fullName +=" "+lookupPerson.get("middleName");
>                 if(lookupPerson.get("lastName") != null)
>                  fullName +=" "+lookupPerson.get("lastName");
>                 if(lookupPerson.get("suffix") != null)
>                  fullName +=" "+lookupPerson.get("suffix");
>               }
>               else
>               {
>                  fullName += " ";
>               }
>               contactMech1 = contactMechGV.get("contactMech");
> 
> if("POSTAL_ADDRESS".equals(contactMech1.getString("contactMechTypeId")))
>               {
>                 postalAddress = contactMechGV.get("postalAddress");
>                 if( postalAddress.get("toName") != null)
>                  {
>                      toName += postalAddress.get("toName").replace(",","
> ");
>                  }
>                  if(postalAddress.get("attnName") != null)
>                  {
>                     attnName += "
> "+postalAddress.get("attnName").replace(","," ");
>                  }
>                  address1 +="
> "+postalAddress.get("address1").replace(",","
> ");
>                  if(postalAddress.get("address2") != null)
>                  {
>                     address2 += "
> "+postalAddress.get("address2").replace(","," ");
>                  }
>                  city +=" "+postalAddress.get("city").replace(","," ");
>                  postalCode += "
> "+postalAddress.get("postalCode").replace(","," ");
>                  if(postalAddress.get("stateProvinceGeoId") != null)
>                  {
>                     state +="
> "+postalAddress.getRelatedOneCache("StateProvinceGeo").get("abbreviation").replace(",","
> ");
>                  }
>                  if(postalAddress.get("countryGeoId") != null)
>                  {
>                     country +="
> "+postalAddress.getRelatedOneCache("CountryGeo").get("geoName").replace(",","
> ");
>                  }
>               }
> 
> if("EMAIL_ADDRESS".equals(contactMech1.getString("contactMechTypeId")))
>               {
>                     email += contactMech1.getString("infoString")+"/";
>               }
> 
> if("TELECOM_NUMBER".equals(contactMech1.getString("contactMechTypeId")))
>               {
>                     telecomNumber = contactMechGV.get("telecomNumber");
>                     if(telecomNumber.get("areaCode") != null)
>                         phone += telecomNumber.get("areaCode").trim();
> 
>                       phone += telecomNumber.get("contactNumber").trim();
> 
>                    // if(telecomNumber.partyContactMech.get("extension")
> !=
> null)
>                     // phone +=
> telecomNumber.partyContactMech.get("extension");
>               }
>              // print(" partyId "+partyId+" email "+email+" fullName
> "+fullName+" address "+address+" phone "+phone);
>         }
>         fw.append(partyId);
>         fw.append(',');
>         fw.append(toName);
>           fw.append(',');
>           fw.append(attnName);
>           fw.append(',');
>         fw.append(address1);
>           fw.append(',');
>         fw.append(address2);
>           fw.append(',');
>           fw.append(city);
>           fw.append(',');
>           fw.append(postalCode);
>           fw.append(',');
>           fw.append(state);
>           fw.append(',');
>           fw.append(country);
>           fw.append(',');
>           fw.append(fullName);
>         fw.append('\n');
> 
>       fw.flush();
>      // fw.close();
>       //response.sendRedirect("control/main");
>     }
> }
> 
> 
> 
> 
> 
> 
> On Wed, Dec 3, 2008 at 2:05 AM, nalin chandra <
> nalin.chandra@palindromesoftware.com> wrote:
> 
>>
>> i use CSV reporting in ofbiz
>>
>> As we all know, we can display data of only one list in the form.
>>
>> so i use view entity to display data of multiple table.
>> now i have one problem.
>>
>> i want to display the detail of party like name, address, email, contact
>> number etc.
>> for this purpose i create a view entity but it only display the email id
>> or
>> telephone number because contactMechId id different for those two, so
>> please
>> help me on this issue..
>>
>> below i paste the view entity code which i use for this purpose:-
>>
>> DynamicViewEntity dynamicView = new DynamicViewEntity();
>> List orderBy = FastList.newInstance();
>> List fieldsToSelect = FastList.newInstance();
>>
>> dynamicView.addMemberEntity("PT", "Party");
>> dynamicView.addAlias("PT", "partyId");
>> dynamicView.addAlias("PT", "statusId");
>> dynamicView.addAlias("PT", "partyTypeId");
>> dynamicView.addAlias("PT", "createdDate");
>> dynamicView.addRelation("one-nofk", "", "PartyType",
>> ModelKeyMap.makeKeyMapList("partyTypeId"));
>> dynamicView.addRelation("many", "", "UserLogin",
>> ModelKeyMap.makeKeyMapList("partyId"));
>>
>>
>> fieldsToSelect.add("partyId");
>> fieldsToSelect.add("statusId");
>> fieldsToSelect.add("partyTypeId");
>> fieldsToSelect.add("createdDate");
>> orderBy.add("createdDate");
>>
>> dynamicView.addMemberEntity("PDS", "PartyDataSource");
>> dynamicView.addAlias("PDS", "visitId");
>> dynamicView.addViewLink("PT", "PDS", Boolean.FALSE,
>> ModelKeyMap.makeKeyMapList("partyId"));
>>
>> fieldsToSelect.add("visitId");
>>
>> dynamicView.addMemberEntity("UL", "UserLogin");
>> dynamicView.addAlias("UL", "userLoginId");
>> dynamicView.addViewLink("PT", "UL", Boolean.FALSE,
>> ModelKeyMap.makeKeyMapList("partyId"));
>>
>> fieldsToSelect.add("userLoginId");
>>
>> dynamicView.addMemberEntity("PE", "Person");
>> dynamicView.addAlias("PE", "firstName");
>> dynamicView.addAlias("PE", "lastName");
>> dynamicView.addViewLink("PT", "PE", Boolean.FALSE,
>> ModelKeyMap.makeKeyMapList("partyId"));
>>
>> fieldsToSelect.add("firstName");
>> fieldsToSelect.add("lastName");
>>
>> dynamicView.addMemberEntity("PC", "PartyContactMech");
>> dynamicView.addMemberEntity("CM", "ContactMech");
>> dynamicView.addMemberEntity("TM", "TelecomNumber");
>> dynamicView.addAlias("PC", "contactMechId");
>> dynamicView.addAlias("CM", "infoString");
>> dynamicView.addAlias("TM", "countryCode");
>> dynamicView.addAlias("TM", "areaCode");
>> dynamicView.addAlias("TM", "contactNumber");
>> dynamicView.addViewLink("PT", "PC", Boolean.FALSE,
>> ModelKeyMap.makeKeyMapList("partyId"));
>> dynamicView.addViewLink("PC", "CM", Boolean.FALSE,
>> ModelKeyMap.makeKeyMapList("contactMechId"));
>> dynamicView.addViewLink("PC", "TM", Boolean.FALSE,
>> ModelKeyMap.makeKeyMapList("contactMechId"));
>>
>> fieldsToSelect.add("infoString");
>> fieldsToSelect.add("contactNumber");
>> fieldsToSelect.add("areaCode");
>> fieldsToSelect.add("countryCode");
>>
>>
>> in ftl file if i display partyLists.infoSting is display null because for
>> telecomNumber there is no infoString value in corresponding column of
>> contactMech table.
>>
>> --
>> View this message in context:
>> http://www.nabble.com/CSV-reporting..-tp20800340p20800340.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> With regards,
> S K Pradeep kumar
> 
> 

-- 
View this message in context: http://www.nabble.com/CSV-reporting..-tp20800340p20815359.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: CSV reporting..

Posted by S K Pradeep kumar <s....@gmail.com>.
Hi,

I think this code will helpful for you

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

import java.util.*;
import org.ofbiz.entity.*;
import org.ofbiz.entity.util.EntityUtil;
import org.ofbiz.base.util.*;
import org.ofbiz.securityext.login.*;
import org.ofbiz.common.*;

import org.ofbiz.party.contact.*;
import org.ofbiz.party.party.*;
import org.ofbiz.accounting.payment.*;
import org.ofbiz.securityext.login.*;


if(partyList != null)
{
 partyListIt = partyList.iterator();
FileWriter fw = new FileWriter("E:\\RAF02Nov\\skp.csv");
      fw.append("partyId");
      fw.append(',');
      fw.append("toName");
      fw.append(',');
      fw.append("attnName");
      fw.append(',');
      fw.append("Address1");
      fw.append(',');
      fw.append("Address2");
      fw.append(',');
      fw.append("City");
      fw.append(',');
      fw.append("PostalCode");
      fw.append(',');
      fw.append("State");
      fw.append(',');
      fw.append("Country");
      fw.append(',');
      fw.append("Full Name");
      fw.append('\n');
    while(partyListIt.hasNext())
    {
        fullName = "";
        toName = "";
        attnName ="";
        address1 = "";
        address2 = "";
        city = "";
        state= "";
        country = "";
        postalCode = "";
        email = "";
        phone ="";
        genericPartyList = partyListIt.next();
        partyId = genericPartyList.getString("partyId");

        List partyContactMechValueMaps =
ContactMechWorker.getPartyContactMechValueMaps(delegator, partyId, false);
        Iterator contactMechIt = partyContactMechValueMaps.iterator();
         while(contactMechIt.hasNext())
         {
              contactMechGV = contactMechIt.next();
              otherValues = PartyWorker.getPartyOtherValues(request,
partyId, "party", "lookupPerson", "lookupGroup");
              lookupPerson = otherValues.get("lookupPerson");

              if(lookupPerson != null)
              {
                if(lookupPerson.get("firstName") != null)
                 fullName += lookupPerson.get("firstName");
                if(lookupPerson.get("middleName") != null)
                 fullName +=" "+lookupPerson.get("middleName");
                if(lookupPerson.get("lastName") != null)
                 fullName +=" "+lookupPerson.get("lastName");
                if(lookupPerson.get("suffix") != null)
                 fullName +=" "+lookupPerson.get("suffix");
              }
              else
              {
                 fullName += " ";
              }
              contactMech1 = contactMechGV.get("contactMech");

if("POSTAL_ADDRESS".equals(contactMech1.getString("contactMechTypeId")))
              {
                postalAddress = contactMechGV.get("postalAddress");
                if( postalAddress.get("toName") != null)
                 {
                     toName += postalAddress.get("toName").replace(","," ");
                 }
                 if(postalAddress.get("attnName") != null)
                 {
                    attnName += "
"+postalAddress.get("attnName").replace(","," ");
                 }
                 address1 +=" "+postalAddress.get("address1").replace(",","
");
                 if(postalAddress.get("address2") != null)
                 {
                    address2 += "
"+postalAddress.get("address2").replace(","," ");
                 }
                 city +=" "+postalAddress.get("city").replace(","," ");
                 postalCode += "
"+postalAddress.get("postalCode").replace(","," ");
                 if(postalAddress.get("stateProvinceGeoId") != null)
                 {
                    state +="
"+postalAddress.getRelatedOneCache("StateProvinceGeo").get("abbreviation").replace(",","
");
                 }
                 if(postalAddress.get("countryGeoId") != null)
                 {
                    country +="
"+postalAddress.getRelatedOneCache("CountryGeo").get("geoName").replace(",","
");
                 }
              }

if("EMAIL_ADDRESS".equals(contactMech1.getString("contactMechTypeId")))
              {
                    email += contactMech1.getString("infoString")+"/";
              }

if("TELECOM_NUMBER".equals(contactMech1.getString("contactMechTypeId")))
              {
                    telecomNumber = contactMechGV.get("telecomNumber");
                    if(telecomNumber.get("areaCode") != null)
                        phone += telecomNumber.get("areaCode").trim();

                      phone += telecomNumber.get("contactNumber").trim();

                   // if(telecomNumber.partyContactMech.get("extension") !=
null)
                    // phone +=
telecomNumber.partyContactMech.get("extension");
              }
             // print(" partyId "+partyId+" email "+email+" fullName
"+fullName+" address "+address+" phone "+phone);
        }
        fw.append(partyId);
        fw.append(',');
        fw.append(toName);
          fw.append(',');
          fw.append(attnName);
          fw.append(',');
        fw.append(address1);
          fw.append(',');
        fw.append(address2);
          fw.append(',');
          fw.append(city);
          fw.append(',');
          fw.append(postalCode);
          fw.append(',');
          fw.append(state);
          fw.append(',');
          fw.append(country);
          fw.append(',');
          fw.append(fullName);
        fw.append('\n');

      fw.flush();
     // fw.close();
      //response.sendRedirect("control/main");
    }
}






On Wed, Dec 3, 2008 at 2:05 AM, nalin chandra <
nalin.chandra@palindromesoftware.com> wrote:

>
> i use CSV reporting in ofbiz
>
> As we all know, we can display data of only one list in the form.
>
> so i use view entity to display data of multiple table.
> now i have one problem.
>
> i want to display the detail of party like name, address, email, contact
> number etc.
> for this purpose i create a view entity but it only display the email id or
> telephone number because contactMechId id different for those two, so
> please
> help me on this issue..
>
> below i paste the view entity code which i use for this purpose:-
>
> DynamicViewEntity dynamicView = new DynamicViewEntity();
> List orderBy = FastList.newInstance();
> List fieldsToSelect = FastList.newInstance();
>
> dynamicView.addMemberEntity("PT", "Party");
> dynamicView.addAlias("PT", "partyId");
> dynamicView.addAlias("PT", "statusId");
> dynamicView.addAlias("PT", "partyTypeId");
> dynamicView.addAlias("PT", "createdDate");
> dynamicView.addRelation("one-nofk", "", "PartyType",
> ModelKeyMap.makeKeyMapList("partyTypeId"));
> dynamicView.addRelation("many", "", "UserLogin",
> ModelKeyMap.makeKeyMapList("partyId"));
>
>
> fieldsToSelect.add("partyId");
> fieldsToSelect.add("statusId");
> fieldsToSelect.add("partyTypeId");
> fieldsToSelect.add("createdDate");
> orderBy.add("createdDate");
>
> dynamicView.addMemberEntity("PDS", "PartyDataSource");
> dynamicView.addAlias("PDS", "visitId");
> dynamicView.addViewLink("PT", "PDS", Boolean.FALSE,
> ModelKeyMap.makeKeyMapList("partyId"));
>
> fieldsToSelect.add("visitId");
>
> dynamicView.addMemberEntity("UL", "UserLogin");
> dynamicView.addAlias("UL", "userLoginId");
> dynamicView.addViewLink("PT", "UL", Boolean.FALSE,
> ModelKeyMap.makeKeyMapList("partyId"));
>
> fieldsToSelect.add("userLoginId");
>
> dynamicView.addMemberEntity("PE", "Person");
> dynamicView.addAlias("PE", "firstName");
> dynamicView.addAlias("PE", "lastName");
> dynamicView.addViewLink("PT", "PE", Boolean.FALSE,
> ModelKeyMap.makeKeyMapList("partyId"));
>
> fieldsToSelect.add("firstName");
> fieldsToSelect.add("lastName");
>
> dynamicView.addMemberEntity("PC", "PartyContactMech");
> dynamicView.addMemberEntity("CM", "ContactMech");
> dynamicView.addMemberEntity("TM", "TelecomNumber");
> dynamicView.addAlias("PC", "contactMechId");
> dynamicView.addAlias("CM", "infoString");
> dynamicView.addAlias("TM", "countryCode");
> dynamicView.addAlias("TM", "areaCode");
> dynamicView.addAlias("TM", "contactNumber");
> dynamicView.addViewLink("PT", "PC", Boolean.FALSE,
> ModelKeyMap.makeKeyMapList("partyId"));
> dynamicView.addViewLink("PC", "CM", Boolean.FALSE,
> ModelKeyMap.makeKeyMapList("contactMechId"));
> dynamicView.addViewLink("PC", "TM", Boolean.FALSE,
> ModelKeyMap.makeKeyMapList("contactMechId"));
>
> fieldsToSelect.add("infoString");
> fieldsToSelect.add("contactNumber");
> fieldsToSelect.add("areaCode");
> fieldsToSelect.add("countryCode");
>
>
> in ftl file if i display partyLists.infoSting is display null because for
> telecomNumber there is no infoString value in corresponding column of
> contactMech table.
>
> --
> View this message in context:
> http://www.nabble.com/CSV-reporting..-tp20800340p20800340.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
>


-- 
With regards,
S K Pradeep kumar