One Table - Multiple Views

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
mgain2013
Posts: 28
Joined: 2013-02-16 16:12

One Table - Multiple Views

Post by mgain2013 » 2017-06-02 04:39

Good Evening!!

I have been racking my brain trying to figure out how to have 2 views attached to one table. I created my first table and named it, then I copied that table using the copy and paste function. So now I have 1 table named sendemail_arcrequest and sendemail_arcrequest_1. I went into the sendemail_arcrequest_1 and pointed the database on table sendemail_arcrequest (sendemail_arcrequest_1_view.php) and changed most of the other values to sendemail_arcrequest except the permissions line and the template lines. My problem is the two forms have different permissions, because two different groups of people are viewing the forms. I got the table to view in the main table for sendemail_arcrequest_1 , however when I click on the table view it opens to an empty page with the exception of the Header for the detail view. It will now populate the page in the detail view, nor the child table view at the bottom of the page. I have tried everything I can think of, but can't get the permissions to work properly. Do any of you have any ideas what I need to do, or is there already a post that I haven't seen, that you know of. Your help would be greatly appreciated. If you need any other details to help me, please let me know!

Many Thanks
Michael

omackeytech
Posts: 20
Joined: 2014-06-04 13:18

Re: One Table - Multiple Views

Post by omackeytech » 2018-11-07 17:20

I used multiple Templates to do the work.
I check to see which group the user belong to and call the appropriate template based on the group.
Like this: (in Time_Entry_view.php)
$mi=getMemberInfo(); $Admin=$mi['admin'];

//Admin sees all columns
if ($Admin)
{
$x->ColWidth = array( 20, 20, 20, 50, 20, 50, 20, 20, 50);
$x->ColCaption = array("Day", "Hours", "Employee Expenses", "Project", "Pay Type", "Mileage ", "Service Call", "Employee");
$x->ColFieldName = array('Day', 'Hours', 'Expenses', 'Project', 'Pay_Type', 'Mileage', 'Job', 'E_Name');
$x->ColNumber = array(2, 7, 8, 10, 11, 12, 13, 15);

// template paths below are used for Admin
$x->Template = 'templates/Time_Entry_templateTV.html';
$x->SelectedTemplate = 'templates/Time_Entry_templateTVS.html';}
//employee sees only 5 columns
else
{
$x->ColWidth = array( 20, 20, 50, 20, 20);
$x->ColCaption = array("Day", "Hours", "Project", "Employee Expenses", "Service Call");
$x->ColFieldName = array('Day', 'Hours', 'Project', 'Expenses', 'Job');
$x->ColNumber = array(2, 7, 10, 8, 13);
// template paths below are used for employee
$x->Template = 'templates/Time_Entry_templateTVE.html';
$x->SelectedTemplate = 'templates/Time_Entry_templateTVES.html';
}

I copied the time_entry_templateTV.html, modified it to show only the columns I wanted the employees to see and saved it as Time_Entry_templateTVE.html. I did the same for the TVS template.

Post Reply