PROBLEM WITH THE WM 60 STRINGTABLE DATATYPE and wM 60 Regular Expression

I am having to populate an N rows X 3 column StringTable where the N rows are obtained from a database table (through a query).

I am running a service to get the ResultSet, then loop through the ResultSet and map the results[i] document’s fields to the StringTable (in a field-by-field manner). When setting the values, I am using the indexing property of the Map “link” to do this.

When looping, I am setting the ROW index to the value of “$iteration minus 1” because the StringTable indexes run from 0 to N-1 while the ResultSet index runs from 1 to N.

I am obtaining the value of “$iteration minus 1” through another service that accepts a String and returns a String (var name = iterationMinusOne) with the numeric value reduced by 1. In the index specification fields of the Map link, i indicate a regular expression for webMethods to evaluate viz. %iterationMinusOne%.

I have also tried this using the output of another service that returns iterationMinusOne as a datatype Object (with a constraint of Ingeter i.e. Integer Object).

The problem is that, In both these cases, the resulting StringTable is inconsistently populated. I don’t see a Nx3 array, and I see a lot of the fields populated as null and overwritten with the last ResultSet field. A simpler service showed that %iterationMinusOne% when iterationMinusOne is a “String” leads to erratic behaviour. My closest guess is that the variable iterationMinusOne needs to be of a particular datatype or must use a specific regular expression to decipher.

Also, are there more regular expression operators within webMethods 6.0 that can do enhanced operations over the % signs??

Please advise if you have a solution to this problem or a direction to proceed. Any help is greatly appreciated …

Sincere Regards,
Shankar Balakrishnan
June 11, 2003.

Hello Shankar,

If your result set is in the form of a recordlist, then

"pub.table:recordListToTable" converts a recordList to a table and then "pub.table:tableToStringTable" converts the table object to a string table. 

There is no need for looping too… .

HTH

Hi Bhavani,

Thanks for your reply! That is a great approach to circumvent indexing. However, after obtaining the ResultSet, I am concatenating 4 columns into a “dot-delimited” string to be placed in the first column of the StringTable.

The end requirement is to use the inbuilt lookupStringTable service so that I can pass a key and get the corresponding values.

Hopefully this further clarifies the situation. Please let me know if you have any ideas for performing the concatenation right in the resultSetToTable service. Meanwhile, I will give it a shot as well …

Thanks again,
Shankar

Hi Bhavani,

The built-in services you have recommended are all deprecated in webMethods 6.0.

Thx,
Shankar

I think StringTable is deprecated too, but I’m not sure.

Rob,

Could you please give me a reference/doc where I could ensure that the StringTable is indeed deprecated. I can think of the following reasons why StringTable should not be deprecated:

  1. The StringTable is a datatype that provides Java HashMap like functionality. Since webMethods does not have any HashMap datatype, it is hard for me to imagine them deprecating an entire datatype.

  2. Deprecating a datatype will surely make code on all previous versions incompatible.

  3. The pub.string:lookupTable built-in service is not deprecated that does lookup on a StringTable (therefore StringTable should not be deprecated).

Thanks for your time.

Regards,
Shankar

I haven’t found any docs along those lines. I think I’m confusing it with some other table type that was deprecated. I should’ve double-checked b4 posting. My apologies.

Hello Shankar,
It was only a guess, that Built in services in wM4.6 continue to be available in wM6.0.

Let me start a new thread on how to handle deprecated services!

Bhavani Shankar

Hi all,

I’m having problems with a mapping step. I’m doing a loop over an in-put array, and inside it mapping some values to an out-put one.
If I type by hand the index in where I want the data to be mapped all works fine. But when I try to use a pipeline variable it doesn’t works (enclosed by %).

Does anyone know why it’s happening this?

Thanks in advance,

Ignasi

Ignasi,

Pipeline variable substitution should work for indexing. I have tried various scenarios (both inside a loop and outside a loop) and it works. Check the value of the variable that you are using for indexing (in %xyz%) at run-time. Let me know if you want to see my sample flows.

Thanks,
Giridhar.

Hi Giridhar,

I’ve already checked that the variable I’m using (in fact is “$iteration” minus 1) has the correct value (0,1,2,3…) I’ve printed in a file and all is correct. But if I use it, after the loop is done, there’s nothing in my output array.

I’ve solved my problem creating a output array in the loop properties and then asignning it to my structure. Anyway it would be grateful if could let me see some sample flow in where this works.

Thanks in advance,

Ignasi

Hi Ignasi,

I think we can’t use a mathematical operation in the index field.Try using just $iteration instead of using ($iteration minus one) and you can see the output array (but with one item more than the input array,item 0 which is null as the $iteration starts with 1).

Using an output array in the loop properties is the better solution.

Hi all again,

There’s no way to solve the problem without using the output array property. The main problem is that I haven’t a LOOP step, I have a REPEAT one over an XMLNodeIterator (so I can’t use LOOP), and there’s no way to define an output array on the REPEAT step.

I’ve tried with %$retries% (same as $iteration but in the REPEAT step)without any mathematical operation, and my document list is still empty. It seems as if only is possible to use a hardcoded index.

Has anyone been able to use a pipeline variable in the indexing property? It would be grateful if someone could help me.

Thanks in advance,

Ignasi

Hi Ignasi,

The reason is because $retries of repeat is not same as $iteration of loop step. The $iteration works. The mathematical operations can be done by simply adding a map step in the loop block and using pub.math java services as transformers to subtract 1, to address the array index problem being 0 while $iteration starts from 1.

The $retries variable is not available in the steps under repeat. This becomes available only after the steps are over and repeat condition is checked. I am not sure how exactly it is happening internally but the variable is not available in the pipeline for sure until after one round is over.

Let us do some research on $retries and find out the work around
Ashok

Hi Ashok,

I’ve printed in a file the value of “$retries” inside the REPEAT step and I’ve obtained the correct values (1,2,3,4… and so on) the first one.

Moreover, I’ve already tried to index with the “$iteration” variable in a LOOP step and it doesn’t work.

In fact I’ve also tried to define a variable, initializing to 0 before the REPEAT step, and adding it in each iteration. But there’s no way to use this variable to indicate in the indexing properties what element of my document list has to be mapped.

In my opinion, the problem is that it’s not possible to perform variable substitution in the indexing property, so that’s why it only works if the index is hardcoded.

Any help would be grateful.

Thanks in advance,

Ignasi

Ignasi,

I am not sure whether we are talking of the same issue. Please see the attached package that you may import. This has a service that has loop step with a working usage of pipeline variable in the indexing property. In case I have misunderstood your issue, please ignore this. Otherwise, looking forward to your feedback.

HTH
Ashok

sample code
forIgnasi.zip (4.4 k)

Ashok,

You’ve correctly understood what I’m talking about. My problem it seems to be that I’m using a “document reference” to a type that contains a list rather that a list itself. I’m not sure if I must “create” or initialize the list before. I send you an attached file with an example of what I’m trying to do.

Thanks in advance,

Ignasi

sample code
forAshok.zip (5.5 k)

Ignasi,

You might have found the solution right now, but as I have encountered the same problem and at least found the solution, here it is :

It’s possible to perform variable substitution in the indexing property if the list is at root (but not possible from a list which is in a single document). So you need a MAP step to map the list from your document to the list itself.
Then it is possible to use the variable substitution.

Hope this will help.

Jonathan