Skip to Content
author's profile photo Former Member
Former Member

how to display all the column names using rowdescriptor

Hi ,

how to traverse the meRepMeta.XML

<?xml version="1.0" encoding="utf-8" ?>

- <MeRepApplication schemaVersion="1.1" id="NAVEENSAMPLEMI" version="01">

<Property name="CLIENT.BUILDNUMBER">01</Property>

<Property name="C_APPLRESOLVE" />

<Property name="DATA_VISIBLE_SHARED" />

<Property name="E_APPLRESOLVE" />

<Property name="FACADE_C_CLIENT">X</Property>

<Property name="FACADE_E_CLIENT">X</Property>

<Property name="HOMEPAGE.INVISIBLE" />

<Property name="INITVALUE" />

<Property name="RUNTIME">JSP</Property>

<Property name="TYPE">APPLICATION</Property>

- <SyncBO id="ZCONTACTS" version="2" type="twoWay" allowCreate="true" allowModify="false" allowDelete="false" reqDirectSync="false" downloadOrder="1">

- <TopStructure name="TOP">

- <Field name="SYNC_KEY" type="N" length="10" decimalLength="0" signed="false" isKey="true" isIndex="true">

<Input type="create">false</Input>

<Input type="modify">false</Input>

</Field>

- <Field name="PERSNUMBER" type="N" length="10" decimalLength="0" signed="false" isKey="false" isIndex="false">

<Input type="modify">false</Input>

</Field>

- <Field name="FIRST_NAME" type="C" length="40" decimalLength="0" signed="false" isKey="false" isIndex="false">

<Input type="modify">false</Input>

</Field>

- <Field name="LAST_NAME" type="C" length="40" decimalLength="0" signed="false" isKey="false" isIndex="false">

<Input type="modify">false</Input>

</Field>

- <Field name="PROFESSION" type="C" length="40" decimalLength="0" signed="false" isKey="false" isIndex="false">

<Input type="modify">false</Input>

</Field>

- <Field name="SEX" type="C" length="1" decimalLength="0" signed="false" isKey="false" isIndex="false">

<Input type="modify">false</Input>

</Field>

- <Field name="BIRTHDAY" type="D" length="8" decimalLength="0" signed="false" isKey="false" isIndex="false">

<Input type="modify">false</Input>

</Field>

- <Field name="WEIGHT" type="P" length="6" decimalLength="2" signed="false" isKey="false" isIndex="false">

<Input type="modify">false</Input>

</Field>

- <Field name="HEIGHT" type="P" length="6" decimalLength="2" signed="false" isKey="false" isIndex="false">

<Input type="modify">false</Input>

</Field>

- <Field name="CATEGORY1" type="N" length="2" decimalLength="0" signed="false" isKey="false" isIndex="false">

<Input type="modify">false</Input>

</Field>

- <Field name="CATEGORY2" type="C" length="20" decimalLength="0" signed="false" isKey="false" isIndex="false">

<Input type="modify">false</Input>

</Field>

- <ChildStructure name="010">

- <Field name="SYNC_KEY" type="N" length="10" decimalLength="0" signed="false" isKey="true" isIndex="true">

<Input type="create">false</Input>

<Input type="modify">false</Input>

</Field>

- <Field name="PERSNUMBER" type="N" length="10" decimalLength="0" signed="false" isKey="false" isIndex="false">

<Input type="modify">false</Input>

</Field>

- <Field name="SEQNO_ADR" type="N" length="10" decimalLength="0" signed="false" isKey="false" isIndex="false">

<Input type="modify">false</Input>

</Field>

- <Field name="CITY1" type="C" length="40" decimalLength="0" signed="false" isKey="false" isIndex="false">

<Input type="modify">false</Input>

</Field>

- <Field name="CITY2" type="C" length="40" decimalLength="0" signed="false" isKey="false" isIndex="false">

<Input type="modify">false</Input>

</Field>

- <Field name="STREET" type="C" length="40" decimalLength="0" signed="false" isKey="false" isIndex="false">

<Input type="modify">false</Input>

</Field>

- <Field name="HOUSE_NUM" type="C" length="40" decimalLength="0" signed="false" isKey="false" isIndex="false">

<Input type="modify">false</Input>

</Field>

- <Field name="REGION" type="C" length="40" decimalLength="0" signed="false" isKey="false" isIndex="false">

<Input type="modify">false</Input>

</Field>

- <Field name="LAND" type="C" length="3" decimalLength="0" signed="false" isKey="false" isIndex="false">

<Input type="modify">false</Input>

</Field>

</ChildStructure>

- <ChildStructure name="020">

- <Field name="SYNC_KEY" type="N" length="10" decimalLength="0" signed="false" isKey="true" isIndex="true">

<Input type="create">false</Input>

<Input type="modify">false</Input>

</Field>

- <Field name="PERSNUMBER" type="N" length="10" decimalLength="0" signed="false" isKey="false" isIndex="false">

<Input type="modify">false</Input>

</Field>

- <Field name="SEQNO_E_MAIL" type="N" length="10" decimalLength="0" signed="false" isKey="false" isIndex="false">

<Input type="modify">false</Input>

</Field>

- <Field name="E_ADDR" type="C" length="40" decimalLength="0" signed="false" isKey="false" isIndex="false">

<Input type="modify">false</Input>

</Field>

- <Field name="E_ADDR_TEXT" type="C" length="40" decimalLength="0" signed="false" isKey="false" isIndex="false">

<Input type="modify">false</Input>

</Field>

</ChildStructure>

</TopStructure>

</SyncBO>

</MeRepApplication>

in which it contains 3 rowdescriptor

<TopStructure name="TOP">

<ChildStructure name="010">

<ChildStructure name="020">

i need to dispaly all columns present which is present in the meRepMeta.XML

but i am getting number of columns present in it , but not able to display the column names

int count = 0 , size =0;

SyncBoDescriptor sbd = descriptorFacade.getSyncBoDescriptor(syncBoName);

RowDescriptorIterator rdi = sbd.getAllRowDescriptors();

RowDescriptor trd = sbd.getTopRowDescriptor();

count = count + trd.getFieldCount();

String[] arrayFieldNames;

size = rdi.size();

int c = 0;

String[] th = new String[rdi.size()];

int[] arr = new int[rdi.size()];

arr[0] = count;

while(rdi.hasNext())

{

arr[c] = trd.getFieldCount();

count = count + trd.getFieldCount();

trd = rdi.next();

th[c] = trd.getRowName();

c++;

}

arrayFieldNames = new String[count];

tableHeaderNamesToDisplay = new String[count];

int i = 0;

int cc = 0;

int ii=0;

if (c >= cc)

{

FieldDescriptor fdi = trd.getFieldDescriptor(th[cc]);

while ( Size == arr[cc])

{

// load array with name foer headers defined in the properties file

arrayFieldNames<i> = fdi.getFieldName();

tableHeaderNamesToDisplay<i> = GetProperties.getString(arrayFieldNames<i>);

i++;

ii++;

}

cc++;

return arrayFieldNames;

but i am able to display one rowdescriptor at a time

i need display all the rowdescriptor

plz provide the soln..

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 11, 2007 at 06:53 PM

    hi sara,

    here's the code:

    static void PrintSyncBoFieldNames(){
     SyncBoDescriptorFacade descFacade = SmartSyncRuntime.getInstance().getSyncBoDescriptorFacade();
     SyncBoDescriptorIterator sbi = descFacade.getAllSyncBoDescriptors();
     while(sbi.hasNext()){
       SyncBoDescriptor sbd = sbi.next();
       String[] topNames = getFieldNames(sbd.getTopRowDescriptor());
       //print top names... 
       RowDescriptorIterator rdi = sbd.getAllRowDescriptors();
       while(rdi.hasNext()){
          String[] childNames = getFieldNames(rdi.next());
          //print child names
       }
     }
    }
    
    static String[] getFieldNames(RowDescriptor rowDescriptor){
     String rowName = rowDescriptor.getRowName();
     //print rowName
     FieldDescriptorIterator fdi = rowDescriptor.getAllFieldDescriptors();
     String[] res = new String[fdi.size()];
     for(int k=0; k<res.length;k++)
       res[k] = fdi.next().getFieldName();
     return res;
    }
    

    do whatever you want on the line with comment //print something

    regards

    jo

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.