Customer Portal

how to get LookupTable into Reformat node's transformClass?

Comments 3

  • Avatar
    avackova
    0
    Comment actions Permalink
    Hi, your graph and transformation class are correct and should work properly. Only there is small bug in DBLookupTable that it doesn't take into account the table name. If you write System.out.println("lookup id : " + lookup.getId()); in your transformation you get the correct ID.
  • Avatar
    achan
    0
    Comment actions Permalink
    Hi Agata,

    How about lookup meta data? i am still getting "null"... i need the lookup meta data in my init() to setup the lookup key:

    public boolean init(Properties props, DataRecordMetadata[] sourceRecordsMetadata, DataRecordMetadata[] targetRecordsMetadata) throws ComponentNotReadyException {

    LookupTable lookup = getLookupTable("lookup_product_types");
    if (!lookup.isInitialized()) {
    lookup.init();
    }

    System.out.println("lookup name : " + lookup.getName());
    System.out.println("lookup metadata : " + lookup.getMetadata());

    String[] lookupKeyStr = {"lookup_product_type_code"};
    RecordKey key = new RecordKey(lookupKeyStr, lookupMetadata);
    key.init();
    lookup.setLookupKey(key);

    ...

    }


    Thanks,
    al
  • Avatar
    avackova
    0
    Comment actions Permalink
    Hi,
    it seems that there is one more bug in DBLookupTable and metadata in lookup table definition are discarded; they are created during first get method. But you need to set record key for the metadata, which you join with lookup table (as in graphDBLookup.grf:
    		// create key 
    String[] lookupKeyStr={"EmployeeID"};
    RecordKey key=new RecordKey(lookupKeyStr,sourceMetadata[0]);
    key.init();
    mylookup.setLookupKey(key);
    )
    By the way for joining data with database could be better DBJoin or LookupJoin component.

Please sign in to leave a comment.