Hi everybody
I am trying to start a list type form by filtered values but I can't just filter them by the field. I need to filter them by an other table then filter by the values I found in my main table I tried a code like this which didn't worked.
ContBusRel.SETRANGE("Business Relation Code",'PROS'); //this works ok
//Cont.GET(ContBusRel."Contact No."); // trying this raises an error
Cont.Setrange("No.",ContBusRel."Contact No."); // this dont work
FORM.RUN(FORM::"ContactList,Cont) //all I have is an empty form
](*,)
ContBusRel is a record var :Contact business relations table
Cont is a record var : contact table
What i want to do is listing lead contacts. I filter contacts type by business contact table and then list them in contact table using thir contact ids [-o<
Comments
You can try this one:
ContBusRel.SETRANGE("Business Relation Code",'PROS');
IF ContBusRel.FIND('-') THEN
REPEAT
Cont.SETCURRENTKEY("Company No.");
Cont.SETRANGE("Company No.",ContBusRel."Contact No.");
IF Cont.FIND('-') THEN
REPEAT
Contact := Cont;
Contact.INSERT;
UNTIL Cont.NEXT = 0;
UNTIL ContBusRel.NEXT = 0;
FORM.RUN(0,Contact);
Contact is a record var : contact table --> TEMPORARY TABLE
You either need to do a FIND or a GET to populate your ConBusRel variable, and then you can use its "Contact No." field to filter your Cont variable. After you have a value in your Cont variable you should have something in your form. This record does not have to be a temporary variable.
One additional tip though: look into using FILTERGROUP, to prevent users from undoing the filters you set in code.
RIS Plus, LLC
MVP - Business Apps
And that's what you don't want.
That's why you need to circle through all ContBusRel records (filtered by PROS) and use its field "Contact No." to find and somehow mark all the contacts you have found. This can be done either by using MARK function or by "inserting temporary table" techinque. Solution by Tirta is exactly the second one.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
(Say.. RobertMo can you give me an example for this function)
I will have to search it though. I have some doubts about starting a cycle, woudn't it couse heavy load on system. is it soutable for big databases ???
Because there would be double job by mark function. First to mark up, second to filter and then show the marked data.
So once you have read the record from DB it is better to put it "client's memory" and do all the processing localy...
Can you do it or you need extra help?
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Still..
to be honest I would greatly appritiate any additional clues on temp table method if it woudn't be much trouble =P~
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯