Page 1 of 1

customer list

Posted: Fri Aug 07, 2009 12:26 pm
by ConvertFromOldNGs
by Mark >> Thu, 23 Oct 2003 4:51:33 GMT

Ive just started using Jade 5.1, ive created a Customer Details form which takes the
Customers First Name (txtFirstName), Last Name (txtLastName) and Customer ID (txtCustomerID) all as strings from the customer.

Ive coded the CustomerDetails form methods such as BtnCancel and BtnOk, ClearTextBoxes, Create Customer and Is Input Okay.

Ive also created a CustomerList form that should list all the Customers added to the CustomerDetails form, this is where im stuck!! Im not
sure how to bring up all the customers added to the CustomerDetails form in the CustomerList form i just created. Any Ideas??

Thanks

Mark

Re: customer list

Posted: Fri Aug 07, 2009 12:26 pm
by ConvertFromOldNGs
by allistar >> Thu, 23 Oct 2003 5:29:01 GMT

Hi Mark,
You should have a collection of those customers stored somewhere. You may, for example, have a Company class, and that has a collection of "allCustomers". You would have an inverse on the Customer class called "myCompany" that would be inversed to the previously mentioned collection.

On the list form load you could display all customers for a company like this:

list.listCollection(company.allCustomers, true, 0);

You would need to implement the "displayEntry" event on the list box to return the name (or whatever) of the customer.

Using this method you would need to know how to get the Company object. There may only be one, or there may be many. If there will only ever be one then you could create a reference to it on the app class called "myCompany". You could set this to Company.firstInstance when the application initialises.

Hope this helps,
Allistar.

------------------------------------------------------------------
Allistar Melville
Software Developer, Analyst allistar@silvermoon.co.nz
Auckland, NEW ZEALAND

Silvermoon Software
Specialising in JADE development and consulting
Visit us at: http://www.silvermoon.co.nz
*NEW* Simple web access to Jade at: www.silvermoon.co.nz/jhp.html ------------------------------------------------------------------

Re: customer list

Posted: Fri Aug 07, 2009 12:26 pm
by ConvertFromOldNGs
by Patwos >> Thu, 23 Oct 2003 9:10:36 GMT

Allistar's advice is a good start, but you may also want to consider downloading Jade 6 and working your way through the online tutorials on this website to familiarise yourself more with some of the features that makes this sort of stuff easy to implement in Jade.

eg: In Jade 6, if you want several collections of customers, say Company.allCustomers that has each and every customer and Company.allGoldCardCustomers that has only customers that have a Gold Card. To set this up, you can still have just the one Customer.myCompany reference on the Customer class with multiple collection references on the Company class as inverses. Company.allCustomers would have no conditions on the inverse. Company.allGoldCardCustomers would use say a condition of Customer.hasGoldCard on the inverse to restrict the entries that are automatically maintained into the Company.allGoldCardCustomers collection reference.

If you get stuck, I'm sure some of us wrinklies will be more than happy to help a newbie, so long as your questions aren't obviously projects set by tutors and lecturers.... {;-p)

Also, why are you using such an old version of Jade when you can download the latest Jade 6 version free of charge? Or did it come with one of the books on Jade in which case you've got a restriced version if my memory serves me correctly and you may find it more beneficial to use the free version.

Hope that helps,
Pat.