Tue Jun 19, 2018 2:59 am
Login Register Lost Password? Contact Us

Use of TYPE structure 'LOAD'

Questions around writing code and queries

Mon May 21, 2018 3:00 pm Change Time Zone


I have presented to me a XML file with nested data sets. Each record in this dataset is tied to a date range though the actual date range is NOT in the XML. The ordinal position of the record in the child dataset specifies the date range.
Record 1 29th April - 5th May
Record 2 6th May - 12th May
Record 3 13th May - 19th May

I know the dates to apply to each record, it would be nice to have the dates in the resultant dataset once the load is complete.

Now I can do an XMLPROJECT or just a straight PROJECT once the load is complete, but I thought I could use the Type structure LOAD qualifier to a record definition to do the whole load and transform in one operation. But I can't see how.
There is no indication given to the function used by the LOAD of its ordinal position so I'm a bit stumped.
However I also know there are some very clever people out there on the forum who might have ideas.

Yours intrigued
Posts: 300
Joined: Sat Oct 01, 2011 7:26 pm

Mon May 21, 2018 3:14 pm Change Time Zone


The TYPE structure is designed for "Alien" data types -- data types included in external files that are not directly supported by HPCC. The TYPE structure allows you to write your own callback functions (LOAD, STORE, etc.) to translate that "alien" data into a format that is natively supported.

Since your date ranges are implied by the ordinal record position and not directly specified, the TYPE structure would be inappropriate for this, IMO.

I'd suggest just using the Date library's Julian data functions to create an expression that would calculate the range for each record based on the COUNTER value in a PROJECT and populate the date range fields that way.


Community Advisory Board Member
Community Advisory Board Member
Posts: 1359
Joined: Wed Oct 26, 2011 7:40 pm

Tue May 22, 2018 8:04 am Change Time Zone

Thanks Richard,

Yes you're right. As I said I have no problem actually constructing the result I need, I was just investigating making use of LOAD callback. I'd not used this feature before, and there's nothing like a real life project for learning.


Posts: 300
Joined: Sat Oct 01, 2011 7:26 pm

Return to Programming

Who is online

Users browsing this forum: Bing [Bot] and 0 guests