BesaHL7 Released v 1.7.17!

Discussion of open issues, suggestions and bugs regarding to (known as Delphi HL7) HL7 Components
Post Reply
admin
Site Admin
Posts: 248
Joined: Sun Jun 05, 2011 8:06 pm

BesaHL7 Released v 1.7.17!

Post by admin »

Dear users,

Besa Software is glad to release the new version 1.7.17

This version includes:
+ Added XPath, XPathSingle properties.

Example document:

Code: Select all

     { "store": {
        "book": [
          { "category": "reference",
            "author": "Nigel Rees",
            "title": "Sayings of the Century",
            "price": 8.95
          },
          { "category": "fiction",
            "author": "Evelyn Waugh",
            "title": "Sword of Honour",
            "price": 12.99
          },
          { "category": "fiction",
            "author": "Herman Melville",
            "title": "Moby Dick",
            "isbn": "0-553-21311-3",
            "price": 8.99
           },
          { "category": "fiction",
            "author": "J. R. R. Tolkien",
            "title": "The Lord of the Rings",
            "isbn": "0-395-19395-8",
            "price": 22.99
          }
        ],
        "bicycle": {
          "color": "red",
          "price": 19.95
        }
      }
     }
Example paths:

Code: Select all

Expression	                                Meaning
$.store.*	                                All direct properties of store (not recursive).
$.store.bicycle.color	                        The color of the bicycle in the store.
$.store..price                                  The prices of all items in the store.
$..price	                                The prices of all items in the store.
$.store.book[*]                                 All books in the store.
$..book[*]	                                All books in the store.
$..book[*].title                                The titles of all books in the store.
$..book[0]	                                The first book.
$..book[0].title	                        The title of the first book.
$..book[0,1].title	                        The title of the first book.
$..book[:2].title	                        The titles of the first two books.
$..book[-1:].title	                        The title of the last book.
$..book[?(@.author=='J. R. R. Tolkien')].title	The titles of all books by J.R.R. Tolkien (exact match, case-sensitive).
$..book[?(@.isbn)]	                        All books that have the isbn property.
$..book[?(@.price < 10)]                        All books cheaper than 10.
JSONPath in Delphi

For selecting multiple values, use XPath property:

Code: Select all

    var
      LObj: TBSObject;
      Matches: TBSValueArray;
    begin
      LObj := TBSObject.FromJSON(...);
      Matches := LObj.XPath['$.store.book[*].author'];
      LObj.Free;
    end;

For selecting first or single value, use XPathSingle property:

Code: Select all

    var
      LObj: TBSObject;
      LValue: TBSValue;
    begin
      LObj := TBSObject.FromJSON(...);
      LValue := LObj.XPathSingle['$.store.bicycle.color'];
      //LValue.AsString = "red"
      LObj.Free;
    end;


We're looking forward to your comments and suggestions.
Besa Sofware Team.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest