Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

How to save multiple values into multiple tables? 11 May 2015 18:37 #12974

I had FORKed the component in order to retrieve the necessary information from my related tables. Check out my screen dump screen shot attached.
This is what I trying to do.
On my normal "Contract" Item view whenever I create a new contract I Only see what you can see in my attached image as "original item info". After saving it it basically goes to a "Contract with Assets" view with in the same model. The Idea is that after saving the contract I can add multiple assets instead of going to add one asset at the time like I originally generated the component with JCOOK.

Therefore I was able to include my other Related items following the JCOOK ideas of retrieving that info. That is not the problem. The problem is that after I choose all the different asset I am not sure what is the best way to save those related "asset" in the asset table since my model is related to "contract"

Please help.

This is a sample of the code used to retrieve the related items in my "contract" model view
$model_asset_id = CkJModel::getInstance('Assets', 'MyComponnentappModel');
		$model_asset_id->addWhere('a.client_id = '.$this->item->client_id); /* To restrict it to only those related to my current Item */
		$model_asset_id->addGroupOrder("a.client_id"); 
		$lists['fk']['asset_id'] = $model_asset_id->getItems();
		
		$model_support_level_id = CkJModel::getInstance('Supportlevels', 'MyComponnentappModel');
		$model_support_level_id->addWhere('a.vendor_id = '.$this->item->vendor_id);	/* To restrict it to only those related to my current Item */
		$model_support_level_id->addGroupOrder("a.vendor_id");
		$lists['fk']['support_level_id'] = $model_support_level_id->getItems();

Please help.

How should I modify my controller in order to save the other data when saving?
MS - Lyquix

Please Log in or Create an account to join the conversation.

How to save multiple values into multiple tables? 12 May 2015 14:06 #12975

I think the code you are looking for is updateXref

www.j-cook.pro/index.php/u/updatexref
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The following user(s) said Thank You: msantana

Please Log in or Create an account to join the conversation.

How to save multiple values into multiple tables? 01 Jun 2015 14:29 #13207

I tried your suggestion but at the end I did not work.

I explain my issue in the following post that I made in Jcook posting.
www.j-cook.pro/index.php/forum/trouble-s...ct-id-for-a-new-item
MS - Lyquix

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.157 seconds

  I found "cook" two days ago. Played around with it for a day and then within a day got rid of two legacy applications in IBM Lotus Domino Notes and replaced them with "cook". It was really easy. A piece of cake. Actually it was even easier than cooking. Cooking involves more work than developing with "cook". What can I say about "cook"? Great application great price for what it delivers great forum with a lot of information and fast responses active and friendly community fast forward moving development cycle So what should I say "Monsieur Le Cook"? Keep the good work going it will lead to success. Having become a paying member in the words of Edith Piaf may I say ..... non rien de rien ... je ne regrette rien. Vive La France.
FK (JED)
         

Get Started