Page 1 of 1

Reading Debtor Notes

PostPosted: Tue May 10, 2016 3:30 pm
by SBarnes
Hi Guys,

Could you provide a brief sample of how read the notes of the debtor object, I am able to load the debtor and even delivery addresses with code like

JiwaFinancials.Jiwa.JiwaDebtors.Debtor debtor = JIMSServer.WebApiApplication.ERP.ERPManager.BusinessLogicFactory.CreateBusinessLogic<JiwaFinancials.Jiwa.JiwaDebtors.Debtor>(null);
debtor.Read(DebtorID);

debtor.DeliveryAddresses.Read();

but when I try and do the same for Notes I get a null reference on the Notes collection itself.

Thanks

Re: Reading Debtor Notes

PostPosted: Wed May 11, 2016 10:23 am
by SBarnes
Hi guys

solved the problem with a call to setup before the read, not sure if this would therefore be a bug as DeliveryAddresses works without the setup call but the Notes collection is null?

Re: Reading Debtor Notes  Topic is solved

PostPosted: Wed May 11, 2016 11:05 am
by Mike.Sheen
SBarnes wrote:Hi guys

solved the problem with a call to setup before the read, not sure if this would therefore be a bug as DeliveryAddresses works without the setup call but the Notes collection is null?


I created a new console application, referenced JiwaApplication,dll, JiwaODBC.dll and JiwaDebtors.dll, and added the following code:
Code: Select all
            var ja = JiwaFinancials.Jiwa.JiwaApplication.Manager.Instance;
            ja.Logon("JiwaMike2", "JiwaDemo157", JiwaFinancials.Jiwa.JiwaODBC.database.AuthenticationModes.JiwaAuthentication, "Admin", "password");

            var debtor = ja.BusinessLogicFactory.CreateBusinessLogic<JiwaFinancials.Jiwa.JiwaDebtors.Debtor>(null);
            debtor.Read("0000000061000000001V");

            foreach(JiwaFinancials.Jiwa.JiwaApplication.Notes.Note note in debtor.Notes)
            {
                System.Diagnostics.Debug.WriteLine("Note: {0}", note.NoteText);
            }

            foreach (JiwaFinancials.Jiwa.JiwaDebtors.DeliveryAddress deliveryAddress in debtor.DeliveryAddresses)
            {
                System.Diagnostics.Debug.WriteLine("Address: {0}", deliveryAddress.Address1);
            }


I did not find the notes property of the debtor as null, but was valid and contained two items. The DeliveryAddress collection also was valid and contained items. You should not be calling any setup method.

Try my snippet above in a new project and see if you still have the same issue. Above was using Jiwa 7.00.157.00 and demo data.

Re: Reading Debtor Notes

PostPosted: Wed May 11, 2016 12:27 pm
by SBarnes
Hi Mike,

Thanks for the response without using your code I commented out the setup call and everything is working fine now, its got me beat because I thought it might have been being caused by a debtor with no notes but I've tested that and it now works fine without the setup also, the only thing I can think of is may be there was some corrupted data and adding a note to the orignal debtor and saving it has fixed whatever it was.