cancel
Showing results for 
Search instead for 
Did you mean: 

how to display all the column names using rowdescriptor

Former Member
0 Kudos

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..

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (0)