This topic is locked
[SOLVED]

 Adding a child directly from one list

10/19/2008 12:27:29 PM
PHPRunner General questions
F
frphilip author

Hi,
Please is there a method to add an button or link to an 'add child' page, directly from a list ?
ex, Say I'got a table orders : Date, customers, etc...

And table 'inside_order', in wich I put products ordered (one record per product).
when I create new order, in fact, I fill the table 'orders', and after, I can see the new order in the list. nice. But to add the first row, I have to go to a inside_order_add.php, find my order, and fill the form. It does work well, but is not very agredable to use.
It should be nice to be able to have and 'add product' button or link directly in the list of orders, near 'edit' one. And of course, in such case, to have the correct order pre-inputed in the form (so, have the id of the order in the url).
Is it possible ?
Thanks for your replies

T
thesofa 10/19/2008

I have written an orders databse, with customers, suppliers, orders, order lines and goods in tables.

If you set up the orders table as the master table and your inside_order table as the child table correctly, you add a new order using inline Add on the master tabler list page, then click Inside_order link to go to the order lines tables. Here you can add inside_order items again just using Inline Add

Make sure thet your SQL for the orders table lists them by added date in reverse order so the last one added is at the top.
The next step is to have a goods in table as a child of the Order lines table to allow for multiple deliveries of the same article on one order.

It works well and saves loads of time for us and for the admin ladies at work.

F
frphilip author 10/19/2008

Thank one more time, thesofa,
It 'does work, the only action to do was to inactivate the checkbox 'hide detail link....' in the 'table link properties' form
but is it possibe to add other links to other script, in the list page ?

T
thesofa 10/19/2008

but is it possibe to add other links to other script, in the list page ?



do you mean have links to other child tables from the same master table?

Yes, you can do that.

F
frphilip author 10/19/2008

Well, it was not my quaestion, but my english, is quite poor <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=34096&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' />
No, the question is : can I add a link in the list, near 'edit', to an other personal script, but with variables in the url.

T
thesofa 10/19/2008

Well, it was not my quaestion, but my english, is quite poor <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=34105&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' />

No, the question is : can I add a link in the list, near 'edit', to an other personal script, but with variables in the url.



Probably, but you will have to do a lot of manual coding, and i cannot help much with that, sorry.

J
Jane 10/20/2008

the question is : can I add a link in the list, near 'edit', to an other personal script, but with variables in the url.



Hi,
to create custom link edit code in HTML mode on the Visual Editor tab.

Then declare used variables in the List page: Before display event:

global $xt;

$xt->assign("variable_name",$variable_value);

F
frphilip author 10/20/2008

Well, I'm sorry, my explanation is not clear <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=34177&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' />
We ve got one list of records, says 10 orders.
What I would like :

J
Jane 10/22/2008

Yes it's possible.

Here is a sample link:

refund.php?myvar={$myvar}


Then add List page: After record processed event on the Events tab:

$row["myvar"] = "xxx";

F
frphilip author 10/22/2008

Hi Jane, I follow you in each of my posts <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=34250&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />
Well, I understand your reply, but I'm only half helped <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=34250&image=2&table=forumreplies' class='bbc_emoticon' alt=':)' /> :
I think that $row() in an array used by one PHPR method, to store user variables, isn't it ?
But where to pick up the value I need ? this value xxx is the one we can see in urls, for variable like editid1=xxx, copyid1=xxx. It is this value that I need. I understood in an other post that variable inputed in fields are stored in an aray $values['field_name']; but for lists, there's no form to access to lists, so I don't know the name of each values extracted from the database before building the full list page.
One more time, sorry for my english <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=34250&image=3&table=forumreplies' class='bbc_emoticon' alt=':(' />

J
Jane 10/23/2008

Hi,
just use $data array in the List page: After record processed event on the Events tab. This array contains values for each row (record) in the table, I.e.

$row["myvar"] = $data["FieldName"];



where FieldName is your actual field name.

M
mustafa 10/23/2008

Hi Jane,
Is there any missing line below?



Hi,
to create custom link edit code in HTML mode on the Visual Editor tab.

Then declare used variables in the List page: Before display event:


I am trying to add custom fields on my list page. Unfortunately, couldn't.


Situation is this:
I have some column fields and averages created automatically below.
I need some custom fields (which will be updated automatically during record adding, editing) to show some manipulated data at the end (e.g. just before pagination).
For example:

Custom_A = Avg_A 1,23 -85 .....

Custom_B = (AvgA + Avg<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=34301&image=2&table=forumreplies' class='bbc_emoticon' alt='B)' />
0,18 .....

Custom_C = Custom_A + Custom_B ....
Are these possible? Thanks a lot.

J
Jane 10/24/2008

Hi,
yes, it's possible.

Use Before record added/updated events on the Events tab for this purpose.

All entered values are stored in teh $values array.

F
frphilip author 10/25/2008

Hi,
Have some sussess with your methode, Jane, but some dificulties, more :
In list_page, after record processed, I add :

global $value_FP;

$value_FP = $data["contactID"];


and in :before dispaly

global $xt,$value_FP;

$xt->assign("test",$value_FP);


In the template, I added for each row a link : myscript.php?myvar={$test}
so, it's almost ok, the datas are in the link, nice <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=34377&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />
but : as $value is not an array, I find the same $test in ALL the links I added for the listpage : the value of $test is, of course, the value of field contactID of the LAST record listed in the page.
I think I could use an array for $value_FP, but in such case, how to have the right$value_FP value in the right row of the list page ?

J
Jane 10/28/2008

Hi,
use List page: After record processed event only.

$row["myvar"] = $data["contactID"];