Lookup tables

Hi,

I have a flatfile that needs to be converted into xml.In flatfile we get codes whose values are not defined in flatfile.While mapping to xml i need to look up table to get the value of code from table(not database).
Can we define property file for code and its values and read it from there or
Is there any other approach through which this can be solved?

Thanks in advance!

A property file or an XML file would work to hold the code translations. Another possibility is using a DB table. Which to use is largely a matter of preference, though if the codes change fairly regularly and others need to view/edit them, a DB table will provide the most flexibility.

Hi,
The codes and their values are going to be constant.Then property file or xml is seems to be good options.Moreover these codes are not viewed or edited.
Thanks Remon for the suggestion!

Mohammed,

If the codes and values are indeed constant, another possibility is to hard-code them into a string table and use pub.string:lookupTable service.

  • Percio

I have around 200 entries of code and values.Will string table be better option or database?

Thanks In Advance!

Use the DB

Rob,

When you get a chance, can you explain why?

Thanks,
Percio

All things being equal, using the DB is a better choice for many reasons.

  • Editing that many entries within Developer can be very tedious.
  • People outside of the IS development team can review/edit the tables, if needed.
  • The tables can be leveraged for other purposes, if appropriate.
  • Backups of the DB will backup these tables too.

The bottom line is that if one puts these into IS, the only place they can be used is IS and the only way they can be edited is with Developer. Storing the lookups in files is a bit better. For 200 entries, it’s better to externalize them and the most flexible approach is to use a DB. Just my opinion of course.

Thank you.

Hi. I’m thinking of populating a set of data from the properties into a string table.

  1. Hence, the property files will have data like
    {{x, x_value}, {y, y_value}, {z, z_value}}

  2. Populate the string table to look like this:
    x, x_value
    y, y_value
    z, x_value

  3. So if i do a lookup, using keyColumnIndex=0, valueColumnIndex=1, key=x,
    i want the output value=x_value.

I need help with this:

  1. How do i write the values into the properties file as a 2 dimensional array , so that it maps into the stringTable field in the developer?

ie. i know to add to a string list, i’ll put into the properties file
nameList = A,B,C,D,E