Author Archives: Niklas - Page 34

webMethods 8.2 Unable to sync Document Type with correct broker Document Type

I stumbled across this problem after removing a Document Type in Designer without removing the corresponding Document Type on the Broker and then creating a new Document Type with the same name as the previous one. In this case the Broker will create a new Document Type with the extension “_1” and all changes will sync to this one instead.

Example:

  1. Delete a Publishable Document Type eg ‘myDocument’ using the Designer (without removing it from Broker)
  2. Now create a new Document Type called ‘myDocument’ and make it publishable
  3. If you now check the Broker Doc Type in the properties you will see that its name is wm::is::myDocument_1

To fix this we have to go through a number of steps:

  1. Open MWS->Messaging->Client Groups and click ‘IntegrationServer
  2. Open tab canPublish and use next to find ‘myDocument‘ and ‘myDocument_1
  3. Tick the box to the left of both Document Types and then click ‘Delete
  4. Open canSubscribe tab and use next to find ‘myDocument‘ and ‘myDocument_1
  5. Tick the box to the left of both Document Types and then click ‘Delete
  6. Now go to MWS->Messaging->Message Types
  7. Use ‘Next‘ to find both the ‘myDocument‘ and ‘myDocument_1
  8. Tick the box to the left of both Document Types and then click ‘Delete
  9. Now go into Designer and find the ‘myDocument‘ Document Type and lock it for edit
  10. In the properties section temporarily change ‘Publishable‘ to ‘false‘ and save
  11. Now change the ‘Publishable‘ property back to ‘true‘ and save

The doctype should now be called ‘myDocument‘ on the Broker and it should also be found in canPublish and canSubscribe on the ‘IntegrationServerClient Group. It is quite a lot of steps to fix this error. To never have to face this situation again be sure to ALWAYS delete the publishable document on the Broker if you remove it in Designer

NOTE! When this happens there is also a possibility that you have to reset the triggers that use this Document type – that has happened to me a few times. Just delete the Document Typer on the trigger and add it back (and set the appropriate filters again) and it should start working again

Tested on webMethods IS 8.2.2

JQuery color every other row in a table

This is so simple and so useful that there is really no excuse to not to have this on your html tables, and it is pretty too 🙂

To change the color of every other row in a table simply add this code to an event that happens after the table has been created:

$("tr:odd").css("background-color", "#bbbbff")

The $(“tr:odd”) selects every tr row with an odd number and the .css() changes its color to #bbbbff – It is as simple as that

Tested on JQuery 1.9.1 and Chrome v28

JQuery sort table rows on column value

Sorting tables dynamically with javascript is often a smooth solution to your sorting problems. I’m here going to put a simple solution that I have been using for a while. I have in no means created this solution – I found it somewhere on the web and now I just want to put it here for easy access.

The table needs to have the following structure for this solution to work:

column1column2column3
value1value2value3
value4value5value6
value7value8value9

The critical parts here is that the table needs an id and a tbody. Without those the sorting will not work

Here is the JQuery code (standard JQuery, no plugins needed)

function sortTable(){
  var rows = $('#mytable tbody  tr').get();

  rows.sort(function(a, b) {

  var A = $(a).children('td').eq(1).text().toUpperCase();
  var B = $(b).children('td').eq(1).text().toUpperCase();

  if(A < B) {
    return -1;
  }

  if(A > B) {
    return 1;
  }

  return 0;

  });

  $.each(rows, function(index, row) {
    $('#mytable').children('tbody').append(row);
  });
}

To sort according to the second column we use ‘.eg(1)’ in row 6 and 7. Second column ‘.eg(3)’ and so on

Here is a JSFiddle of the solution: JQuery sort table rows on column value

Tested on Chrome v44.0.2403.155 (64-bit) and JQuery 1.9.1