Parent/Filter #1

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
andyrav
User
Posts: 641

Parent/Filter #1

Post by andyrav »

Hi
Is it possible to change the parent and filter field to another value if a field equal a certain value?

many thanks


mobhar
User
Posts: 11703

Post by mobhar »

Curently it is not supported.


kirondedshem
User
Posts: 642

Post by kirondedshem »

try to explain what you want to achieve in detail, with clear examples coz there is always a way you can emulate a possible solution.


andyrav
User
Posts: 641

Post by andyrav »

what is would to do is is change to current partent/filter value to a diferent value if the cutomer = 'xyz' else leave at current vaule.


kirondedshem
User
Posts: 642

Post by kirondedshem »

am not sre yet but i dont htink you can setup the parent child relatioship dynamically but there are other ways to achieve it
what is would to do is is change to current partent/filter value to a diferent value if the cutomer = 'xyz' else leave at current vaule.

This is till not clear enough.Let me give you an example of how to explain it
First parent filter means you have two or more fileds where you selecting a vlaue in one determies how you will select a value in the next. eg If I can have a table
table:subcounties
field:district_id(links to district table)
field:county(linkts to countys table)
field:subcounty_name
---etc etc------

When i want to add a subcounty I would want a user to only select counties belonging to a given district, that way he meust always first select a district which will filter the list of counties to show only available counties macthing the district. For that I setup parent filter on district_id and county_id where district_id is the parent.
An example of what you might want to explain
Now assume for some reason I have another feild called region_id(links to a bunch of rfegions), where I would like depending on the situation or value of a given filed(you need to cleary expalin the situation as well and how it comes about), I would want to use a parent filter where I must select subcounties belonging to only a given region. This mean I want to use parent filter where parent field is region_id instead.

Possible solutions for this would be:

1(easiest).
I would setup as many parent filter relationships, I can event create dummy custom fields if i want to. eg I would also connect county_id to region_id using parent relationship as well(this is such all the parent child relationships are available when i need it). Now depending on the condition I just need to hide other fields(using Visible=FALSE or jquery in startup script), such that the form is only left with the fields which have the parent filter that i need to see. Just ensure to handle teh code in row_inserting properly such that you pick right value from whatever filed.

2(harder since its somehow manual and you need to be very code ready and creative).
You also just do this yourself.Its better if you are using select controlls for both fileds since using autocomplete might be a bit hard for you but if need e its also doable.
eg depending on the condition, you can use ajax to query for a list of parent records from desired the fill them up in the parent field. You then attach an onchange event to it, such that when selected It will also use ajax to query for whatever child tabel for the records matching its requirement and fills them up into the child controll. This way you can achive a parent child realtionship anyway you like.

3.(only works if you can use views and union to achive a combined dataset, and if the data is not so complicated). If i know i have two tables I have to pick the child data from yet the parent field still has to pick from the same table. Then I can use UNION to create a view having records from both table in one view but with a filter field to tell me which tale each record belong to. Then depending on the condition. I can then set the filter value in field settings oc child field to only show records from a particular table, that way the union view containing filed from both tables will then only return those of table interest.

So if your problem is similar to what ive anticipated, you can try these, You can also put more creativity to it and combine ideas.
Otherwise you can give a more very elaborate explanation(live example, diffrent senario that cause te condition, database structure etc so other can see what you see and why you see it that way ) and see if anyone can help you create one


Post Reply