Loading custom fields from Quickbooks
-
99% of the time,
customer.DataExtRetList != null
. This was supposed to fix the edge cases when
customer.DataExtRetList == null
.
if (customer.DataExtRetList != null) {
this.QBInfo.DateCatSent = "";
this.Source = "";
} else {
for (int i = 0; i < customer.DataExtRetList.Count; i++) {
IDataExtRet ext = customer.DataExtRetList.GetAt(i);
if (ext.DataExtName.GetValueOrEmpty() == "Date Cat. Sent")
this.QBInfo.DateCatSent = ext.DataExtValue.GetValueOrEmpty();
else if (ext.DataExtName.GetValueOrEmpty() == "Source")
this.Source = ext.DataExtValue.GetValueOrEmpty();
}
} -
99% of the time,
customer.DataExtRetList != null
. This was supposed to fix the edge cases when
customer.DataExtRetList == null
.
if (customer.DataExtRetList != null) {
this.QBInfo.DateCatSent = "";
this.Source = "";
} else {
for (int i = 0; i < customer.DataExtRetList.Count; i++) {
IDataExtRet ext = customer.DataExtRetList.GetAt(i);
if (ext.DataExtName.GetValueOrEmpty() == "Date Cat. Sent")
this.QBInfo.DateCatSent = ext.DataExtValue.GetValueOrEmpty();
else if (ext.DataExtName.GetValueOrEmpty() == "Source")
this.Source = ext.DataExtValue.GetValueOrEmpty();
}
}Daer frnds, need help urgenz. Most time my code simply not work. Sometime it give errro refernce not setting object. Plz help its urgentz.
-
Daer frnds, need help urgenz. Most time my code simply not work. Sometime it give errro refernce not setting object. Plz help its urgentz.
Why do you think I posted it in this forum? Did you miss the mistake? :)
-
99% of the time,
customer.DataExtRetList != null
. This was supposed to fix the edge cases when
customer.DataExtRetList == null
.
if (customer.DataExtRetList != null) {
this.QBInfo.DateCatSent = "";
this.Source = "";
} else {
for (int i = 0; i < customer.DataExtRetList.Count; i++) {
IDataExtRet ext = customer.DataExtRetList.GetAt(i);
if (ext.DataExtName.GetValueOrEmpty() == "Date Cat. Sent")
this.QBInfo.DateCatSent = ext.DataExtValue.GetValueOrEmpty();
else if (ext.DataExtName.GetValueOrEmpty() == "Source")
this.Source = ext.DataExtValue.GetValueOrEmpty();
}
}Ouch.
I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image. Stephen Hawking
-
Why do you think I posted it in this forum? Did you miss the mistake? :)
And do you see that I marked it as a joke? Oh dear, I know the meaning of this forum, and I saw the problems the code snippet causes. And I posted like someone would do who uses to write such code. That seems to be beyond the joking capacity of an average CP member though, as can be deduced from the votes...
-
99% of the time,
customer.DataExtRetList != null
. This was supposed to fix the edge cases when
customer.DataExtRetList == null
.
if (customer.DataExtRetList != null) {
this.QBInfo.DateCatSent = "";
this.Source = "";
} else {
for (int i = 0; i < customer.DataExtRetList.Count; i++) {
IDataExtRet ext = customer.DataExtRetList.GetAt(i);
if (ext.DataExtName.GetValueOrEmpty() == "Date Cat. Sent")
this.QBInfo.DateCatSent = ext.DataExtValue.GetValueOrEmpty();
else if (ext.DataExtName.GetValueOrEmpty() == "Source")
this.Source = ext.DataExtValue.GetValueOrEmpty();
}
} -
99% of the time,
customer.DataExtRetList != null
. This was supposed to fix the edge cases when
customer.DataExtRetList == null
.
if (customer.DataExtRetList != null) {
this.QBInfo.DateCatSent = "";
this.Source = "";
} else {
for (int i = 0; i < customer.DataExtRetList.Count; i++) {
IDataExtRet ext = customer.DataExtRetList.GetAt(i);
if (ext.DataExtName.GetValueOrEmpty() == "Date Cat. Sent")
this.QBInfo.DateCatSent = ext.DataExtValue.GetValueOrEmpty();
else if (ext.DataExtName.GetValueOrEmpty() == "Source")
this.Source = ext.DataExtValue.GetValueOrEmpty();
}
}I can do it even better ... Yesterday I found that gem in my own code
Boolean deleted = false;
if(deleted){
...
}what a great luck I wrote it only five minutes before I observed my supersophisticated State-of-the-art-Failure... :-D :-O