Wednesday, August 20, 2008

How to get time code id given a time code name

You can use CodeMapper to lookup a time code ID.

First create an instance of CodeMapper, it takes a DBConnection as a parameter.

CodeMapper mapper = CodeMapper.createCodeMapper(conn);

If you happen to be writing a Rule, you can simply get CodeMapper from the WBData parameter.

CodeMapper mapper = wbData.getCodeMapper();

Next, lookup the TimeCodeData using the CodeMapper instance and the time code name as a parameter.

TimeCodeData timeCode = mapper getTimeCodeByName(timeCodeName);

int id = timeCode .getTcodeId();

No comments: