While I'm poking away at this, I thought I'd check with the collective wisdom. I've found a situation where I want to take advantage of CURSORTOXML and XMLTOCURSOR. The issue I'm running into is if the cursor being converted to XML has fields with NULL values in the first record, this appears to affect the resulting XMLTOCURSOR conversion. Any NULL columns will be missing from the result cursor even if later rows in the XML contain values. The hacky workaround seems to be I have to make sure that the first record has non-null values for all columns I want in the cursor. Anyone have any other magic tricks?
TIA
--
rk
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
I tend to create the cursor and use flags to append to the existing cursor.
Tracy
On March 29, 2022 7:01:47 PM EDT, Richard Kaye rkaye@invaluable.com wrote:
While I'm poking away at this, I thought I'd check with the collective wisdom. I've found a situation where I want to take advantage of CURSORTOXML and XMLTOCURSOR. The issue I'm running into is if the cursor being converted to XML has fields with NULL values in the first record, this appears to affect the resulting XMLTOCURSOR conversion. Any NULL columns will be missing from the result cursor even if later rows in the XML contain values. The hacky workaround seems to be I have to make sure that the first record has non-null values for all columns I want in the cursor. Anyone have any other magic tricks?
TIA
--
rk
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]
VGhhdOKAmXMgYW5vdGhlciBwb3NzaWJpbGl0eS4gVGhhbmtzLCBUcmFjeS4g8J+Yig0KDQpUaGUgb3JpZ2luYWwgZGF0YSBzb3VyY2UgaXMgY29taW5nIGZyb20gYSBTUUwgYmFja2VuZCBzbyBJ4oCZdmUganVzdCBhZGRlZCBzb21lIElTTlVMTCBjYWxscyBhcm91bmQgdGhlIGZpZWxkcyB3aGljaCBtYXR0ZXIgdG8gdGhlIENVUlNPUlRPWE1ML1hNTFRPQ1VSU09SIGNhbGxzLg0KDQotLQ0KDQpyaw0KDQpGcm9tOiBQcm9mb3hUZWNoIDxwcm9mb3h0ZWNoLWJvdW5jZXNAbGVhZmUuY29tPiBPbiBCZWhhbGYgT2YgVHJhY3kgUGVhcnNvbg0KU2VudDogVHVlc2RheSwgTWFyY2ggMjksIDIwMjIgN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dlFZOVM3cjA5Zj9kb21haW49bGVhZmUuY29tPg0KVGhpcyBtZXNzYWdlOiBodHRwczovL2xlYWZlLmNvbS9hcmNoaXZlcy9ieU1JRC81ODNCRDE3MC02OUVFLTQzMzctOTVGNi0wODNDMjlCQjA1QUFAcG93ZXJjaHVyY2guY29tPGh0dHBzOi8vcHJvdGVjdC11cy5taW1lY2FzdC5jb20vcy93STlCQ3F4VnJsVHpMcTFIdkpnWUY/ZG9tYWluPWxlYWZlLmNvbT4NCioqIEFsbCBwb3N0aW5ncywgdW5sZXNzIGV4cGxpY2l0bHkgc3RhdGVkIG90aGVyd2lzZSwgYXJlIHRoZSBvcGluaW9ucyBvZiB0aGUgYXV0aG9yLCBhbmQgZG8gbm90IGNvbnN0aXR1dGUgbGVnYWwgb3IgbWVkaWNhbCBhZHZpY2UuIFRoaXMgc3RhdGVtZW50IGlzIGFkZGVkIHRvIHRoZSBtZXNzYWdlcyBmb3IgdGhvc2UgbGF3eWVycyB3aG8gYXJlIHRvbyBzdHVwaWQgdG8gc2VlIHRoZSBvYnZpb3VzLg0K--- StripMime Report -- processed MIME parts ---multipart/alternative text/plain (text body -- kept) text/html---
Let’s try this again. (Stupid Outlook…)
That’s another possibility. Thanks, Tracy. 😊
The original data source is coming from a SQL backend so I’ve just added some ISNULL calls around the fields which matter to the CURSORTOXML/XMLTOCURSOR calls.
--
rk
From: ProfoxTech profoxtech-bounces@leafe.com On Behalf Of Tracy Pearson Sent: Tuesday, March 29, 2022 7:33 PM To: profoxtech@leafe.com Subject: Re: CURSORTOXML and NULLs
I tend to create the cursor and use flags to append to the existing cursor.
Tracy
On March 29, 2022 7:01:47 PM EDT, Richard Kaye <rkaye@invaluable.commailto:rkaye@invaluable.com> wrote: While I'm poking away at this, I thought I'd check with the collective wisdom. I've found a situation where I want to take advantage of CURSORTOXML and XMLTOCURSOR. The issue I'm running into is if the cursor being converted to XML has fields with NULL values in the first record, this appears to affect the resulting XMLTOCURSOR conversion. Any NULL columns will be missing from the result cursor even if later rows in the XML contain values. The hacky workaround seems to be I have to make sure that the first record has non-null values for all columns I want in the cursor. Anyone have any other magic tricks?
You could consider your TSQL query to give you the XML in the initial query.
using :
Select ....
FOR XML PATH('NameOfDataHere'), ROOT('NameOfDataHere'), ELEMENTS
When you name the columns, put in the XML element path/name
c.ClientCity as "billTo/address/city",
On Tue, Mar 29, 2022 at 6:45 PM Richard Kaye rkaye@invaluable.com wrote:
Let’s try this again. (Stupid Outlook…)
That’s another possibility. Thanks, Tracy. 😊
The original data source is coming from a SQL backend so I’ve just added some ISNULL calls around the fields which matter to the CURSORTOXML/XMLTOCURSOR calls.
--
rk
From: ProfoxTech profoxtech-bounces@leafe.com On Behalf Of Tracy Pearson Sent: Tuesday, March 29, 2022 7:33 PM To: profoxtech@leafe.com Subject: Re: CURSORTOXML and NULLs
I tend to create the cursor and use flags to append to the existing cursor.
Tracy
On March 29, 2022 7:01:47 PM EDT, Richard Kaye <rkaye@invaluable.com mailto:rkaye@invaluable.com> wrote: While I'm poking away at this, I thought I'd check with the collective wisdom. I've found a situation where I want to take advantage of CURSORTOXML and XMLTOCURSOR. The issue I'm running into is if the cursor being converted to XML has fields with NULL values in the first record, this appears to affect the resulting XMLTOCURSOR conversion. Any NULL columns will be missing from the result cursor even if later rows in the XML contain values. The hacky workaround seems to be I have to make sure that the first record has non-null values for all columns I want in the cursor. Anyone have any other magic tricks?
[excessive quoting removed by server]