Setselectionfilter(record)

Dear All,
I wonder about this coding (A and B) structure different that I put in a commandbutton as follows:
coding A:
record2.SETCURRENTKEY(“fieldx”,record2.“fieldx”);
record2.SETRANGE(“fieldy”,“fieldy”::rr);
record2.SETRANGE(record.“fieldz”,“w”);
FORM.RUNMODAL(FORM::“UUU”,record2);

coding B:
CurrForm.SETSELECTIONFILTER(record1);

How to differentiate them…?
I would welcome to receive your answers. Thanks in advance.

Rgds,
Mark

The codings hev completely different meanings and cannot really be compared.

Coding A defines a filtered view on the record2 table shown by form UUU.

So form UUU will only show the records you filtered for.

Coding B will return the (multiple) selected records of the form and apply a filter for only those on Record1.

Example: Form is showing the items 1,2,3,4,5 and you are selecting 2 and 5. After calling CurrForm.SETSELECTIONFILTER(record1);, the record1 qould contain your items 2 and 5 only.

Dear Thomas and all,

tks a lot for your reply. It means that coding A only shows one line in the other form (UUU) according to the record there. but coding B can be more than one line. But how it works…? do I need to create additional coding to make it work…? for example CU, table or form, where will I put it, in the Global or Local…? Are there many parameters, variables (in Global or Local), functions, return values…?

Could you give me a sample of the coding…? For example, I have a table R consists of header A and line B but the header table and line table are different, I create a form C consists of tablebox, tabcontrol and frame with source table is the header A, then I want to use setselectionfilter(record1 = the header A), to transfer to a form D whose sourcetable is a table E (no header and no line table), do I need to create coding anymore like what I mentioned in paragraph one ?

Pls let me know your answer. I expect it so much

Rgds,

Mark

Dear Thomas and all,

tks a lot for your reply. It means that coding A only shows one line in the other form (UUU) according to the record there. but coding B can be more than one line. But how it works…? do I need to create additional coding to make it work…? for example CU, table or form, where will I put it, in the Global or Local…? Are there many parameters, variables (in Global or Local), functions, return values…?

Could you give me a sample of the coding…? For example, I have a table R consists of header A (table A) and line B (line table B) but the header table and line table are different, I create a form C consists of tablebox, tabcontrol and frame with source table is the header A, then I want to use setselectionfilter(record1 = the header A), to transfer to a form D whose sourcetable is a table E (no header and no line table), do I need to create coding anymore like what I mentioned in paragraph one ? The coding I put in the commandbutton like this one:

CurrForm.SETSELECTIONFILTER(record1);
FORM.RUN(FORM::“form A”,formA);

Using the above, setselectionfilter doesn’t work good.

Pls let me know your answer. I expect it so much

Rgds,

Mark

Why would you transfer the Header A to the form D if that is not header nor line. What is the connection between table A and table E ?

Tks again for your reply but I expect your reply in my inbox. I want that the data in header and item in the line transferred automatically to form D that it built from a table D. I set fields in the table D connects to table A and table A’s line. Like purchase order has purchase header and purchase line and its data transferred or filled to a certain table/form (in this case table D) by using command button from a form G that is source table is table A, how to do it then…?.

Rgds,

Mark

I still have a problem to really understand what you want to do.

Do you want to “Prefill” fields in the table D with values from table A and then add some additional information manually in form G ?

Dear Thomas,

No, I don’t want to prefill and adding manually. I will repeat or reexplain and just forget the old question, what I wanna do as follow:

  1. Table A : header

  2. Table B : line and it will be a subform sourcetable with the header is table A

  3. Form C : have sourcetable table B

  4. Table D : consists of fields that have tablerelation and flowfields directly to table A, B and F

  5. Form E : it’s table D’s form. form D’s sourcetable is table D

  6. Form F : it’s sourcetable is table G

  7. Table G : consists of some fields (it’s a matrix form (date and item in the line it can be like production forecasting form))

Table G contains a field that I want it to be filled automatically by the system to table Ds’ field but not directly from the field but there is a command button, I just only select the date I want that it’s also be recorded at the table D (e.g. field x and field y), because the fields have tablerelation to table F. The table B is a line (e.g. like purchase line). The item is inserted in the line. Form C will display all headers (table A). Form C can be considered as same as production order status change form. I want to move some lines in form C to form D using setselectionfilter. After that, the field x and y will be filled automatically after I go to form E to all lines that have been selected there.

I hope it can be more clear but if not allow me to send e-mail to you. tks for your kind attention to me, I am indebted so much.

Rgds,

Mark