Reading Debtor Notes  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Reading Debtor Notes

Postby SBarnes » Tue May 10, 2016 3:30 pm

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
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191

Re: Reading Debtor Notes

Postby SBarnes » Wed May 11, 2016 10:23 am

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?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191

Re: Reading Debtor Notes  Topic is solved

Postby Mike.Sheen » Wed May 11, 2016 11:05 am

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.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Reading Debtor Notes

Postby SBarnes » Wed May 11, 2016 12:27 pm

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.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 2 guests