Grouping

16 posts by 2 authors in: Forums > CMS Builder
Last Post: September 19, 2011   (RSS)

By KCMedia - June 2, 2011

Hi

i have this webpage and there are downloads and when they upload documents they have to select either Forms for Employers or Forms for Employees what i want to do is group the forms together with a heading for each section and then the list of downloads below them.

this is the sample page.http://www.opsjobs.com.au/newsite/forms.php

also attached is the page code.
Thanks



Craig

KC Media Solutions

www.kcmedia.biz
Attachments:

forms.php 12K

Re: [kcmedia] Grouping

By Jason - June 2, 2011

Hi Craig,

In your forms section, how are you distinguishing between "Employer" and "Employee" forms?

The easiest approach would be to use 2 queries, one to get the Employer forms and one to get the Employee forms.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Grouping

By KCMedia - June 2, 2011

Hi Jason

i have a drop down and it is called Section with the 2 option in it.
Thanks



Craig

KC Media Solutions

www.kcmedia.biz

Re: [kcmedia] Grouping

By Jason - June 3, 2011

Hi Craig,

What you can do then is do 2 different queries, one to get each section.

For example, if we assume the drop down box is called "form_type" values of the 2 options in the drop down are "employer" and "employee" we can do our queries like this:

// load employer form records
list($employerFormsRecords, $employerFormsMetaData) = getRecords(array(
'tableName' => 'forms',
'allowSearch' => false,
'where' => "form_type = 'employer'"
));

// load employee form records
list($employeeFormsRecords, $employeeFormsMetaData) = getRecords(array(
'tableName' => 'forms',
'allowSearch' => false,
'where' => "form_type = 'employee'"
));


Then you just need 2 different foreach loops, one to output each type of record.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Grouping

By KCMedia - June 3, 2011

Hi Jason

that is great but i tried it and it wont work.
Thanks



Craig

KC Media Solutions

www.kcmedia.biz
Attachments:

forms_001.php 14K

Re: [kcmedia] Grouping

By Jason - June 5, 2011

Hi Craig,

What happens when you execute that code? Do you get an error?

Let me know,
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [kcmedia] Grouping

By Jason - June 6, 2011

Hi Craig,

I'm going to need some more information in order to be able to troubleshoot this further.

What type of field is "section"? What are the different values it can have?

If you add this to your code:
// load employer form records
list($employerFormsRecords, $employerFormsMetaData) = getRecords(array(
'tableName' => 'forms',
'allowSearch' => false,
'where' => "section = 'employer'",
'debugSql' => true,
));


What is the query that gets output?

Let me know
Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Grouping

By KCMedia - June 6, 2011

Hi Jason

the section is just a list drop down with 2 option in it

also when i put that debug line into the code it wont let the page load at all just a blank white page.
Thanks



Craig

KC Media Solutions

www.kcmedia.biz

Re: [kcmedia] Grouping

By Jason - June 6, 2011

Hi Craig,

If you like I can take a quick look to see what's going on in there. Just fill out a [url http://interactivetools.com/support]2nd Level Support Request[/url] and I can see if I can find the problem quickly.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/