Hi all!
I was trying to find some information/tips about having an action button (or modifiying an existant one) to do this:
- I have a parent_table, a child_table and a master_table and what I want to do is:
1) I create a register in the parent_table
2) If the field1 of the parent_table equals the field2 of the master_table, then I want to retrieve some columns of a record from the master_table and copy them to the child_table
3) I would like to retrieve not just the columns from one record but from all registers that match the condition (parent_table.field1 = master_table.field2)
I tried to find a post talking about this but couldn't find any.
Thanks in advance
Copy registers from one table to another according to specific conditions
Re: Copy registers from one table to another according to specific conditions
I would look at creating a button in a JQuery -dv script, or even in the dv hook. The button would invoke a .php script that would do the SQL. I have this to create a button in a dv hook. This uses the Helpers library from Bizzworkxx (https://appgini.bizzworxx.de/).
The PHP script would have code like in a hook to do the SQL. At the end, something like
to return focus back to the tableview.
Good luck.
~Paul
Code: Select all
if($memberInfo['group'] =='Admins') {
ob_start(); ?>
<script>
$j(function(){
if ($j( '#Status' ).val() == "Just Added") {
// Show button to Send Request
var targetRootURL = "hooks/send_request.php?recID=";
// var targetURL = targetRootURL;
var targetURL = targetRootURL.concat($j( 'input[name=SelectedID]' ).val());
var dv = new AppGiniDetailView();
var actionbuttons = dv.actionbuttons;
var group = actionbuttons.addGroup("Actions");
group.addLink("Send Request", targetURL, Variation.Primary, "send");
}
})
</script>
<?php
$new_layout = ob_get_contents();
ob_end_clean();
$html .= $new_layout;
}
Code: Select all
echo '<script type="text/javascript">
alert("Request sent, press ok to continue")
window.location.href = "../tablename_view.php"
</script>';
Good luck.
~Paul
Re: Copy registers from one table to another according to specific conditions
Thanks, I would try this solution