I do not understand what you want to reach. You want to have more Codes from the linked table in one field in one record??? No, it is not possible - if you have field connected to another table, you can have only one value from the connected table there... if you want something as filter in the field, you must disable relation test on the field and create your own OnLookup etc...
With my text field arrow symbol is attached because of that TableRelation propery. Whenever i click that arrow symbol, one lookup window will get opened. Data in that lookup window will come from some another table.
I want to select multiple values from that lookup window and want to assign all those values to that text field.
It is not so simple and as I can see, you are not enough skilled, but I can try to direct you to some code which can help you...
If you go to the Budgets form, to the G/L Account filter, when you click the arrow, select more lines, click OK, there will be Filter entered, which include all the values, you selecte... you can be inspired with this...
I saw the code. When i click that arrow values selected by me will be stored in one variable and those selected values will be displayed in the matrix box. Am i right?
But what i want is whatever values i select those values should get stored in the table field.
e.g
Suppose my table name is Customer and it has one field named Segment then wheneve i select multiple values from that lookup table all those values should get stored in Segment field of Customer table.
Can i do the same by providing a command button next to the text field.
So when i click on command button lookup table will appear and i will select the multiple values from it.
Can't you set the ValidateTableRelation and the TestTableRelation properties to No? That way you still have the lookup into the other table, but you can enter what you want.
Right, so you want to lookup value A, then value B, and have both of them show up. I guess you could teach users to copy the A value before they look up value B and paste it in, but that is not very user friendly is it
I will provide one command button next to the text field. Then PushAction property of that button will be set to RunObject and RunObject property will be set to Table table_name . Now in that table i will have two fields, one will contain the data that i want to insert in the text field and second field will contain checkboxes. so when i click on that command button , lookup table will appear and then i will check those checkboxes whose corresponding first field values i want.
Can i do this?
if yes then how. i.e. Which trigger should i use? How can i find out which checkboxes are selected?
Please help
You must think that more than one user can click the button and check the checkboxes... you must use temp table or have some sort of filtering to user than... solution is to call the form through form variable, in this way:
FormVar.SETTABLEVIEW(FilteredRecord); //set what you want to show
FormVar.LOOKUPMODE := true;
IF FormVar.RUNMODAL = ACTION::LookupOK THEN BEGIN
ListForm.GetRecords(FilteredRecord);
if FilteredRecord.FIND('-') then
repeat
if Txt <> '' then
Txt := Txt + '|';
Txt := Txt + FilteredRecord.Field; //result in Txt will be 'Val1|Val2|Val3'
until FitleredRecord.NEXT=0;
END;
Code in form:
GetRecords(VAR Param : Record YourTable)
CurrForm.SETSELECTIONFILTER(Param); //copy selection filter to the param
It will include all values which you (user) select - all blue records...
Now i am able to select the multiple values. But one problem is there.
I am assigning selected multiple values to one variable. Now how can i transfer the value of that variable to a field of a table.
I have written following code for that. No error is there but value doesn't get transferred from variable to field in a table.
segval:=segcode.getvalue(); // segval is a variable
searchin.OPEN(18);// table 18 contains the field to which i want to assing value
searchin.NEXT();
searchinfield:=searchin.FIELD(2);
searchinfield.VALUE(FORMAT(segval));
COMMIT;
segval:=segcode.getvalue(); // segval is a variable
searchin.OPEN(18);// table 18 contains the field to which i want to assing value
searchin.NEXT();
searchinfield:=searchin.FIELD(2);
searchinfield.VALUE(FORMAT(segval));
COMMIT;
1. COMMIT not mandatory
2. You have to "save" the record after modification with searchin.MODIFY
Now instead of writing a code can i do the same by setting property.
i.e. can't i directly assign value of the variable to the field, by setting the SourceExpr and TableRelation property so that i need not to first find out the correct record and then to insert value of variable to a field.
FormVar.SETTABLEVIEW(FilteredRecord); //set what you want to show
FormVar.LOOKUPMODE := true;
IF FormVar.RUNMODAL = ACTION::LookupOK THEN BEGIN
ListForm.GetRecords(FilteredRecord);
if FilteredRecord.FIND('-') then
repeat
if Txt <> '' then
Txt := Txt + '|';
Txt := Txt + FilteredRecord.Field; //result in Txt will be 'Val1|Val2|Val3'
until FitleredRecord.NEXT=0;
END;
This will cause overflow errors once the length of all the records' fields exceeds the length of Txt. You should program a check for the string length in the loop, to prevent that error.
Comments
Please, post more details...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
With my text field arrow symbol is attached because of that TableRelation propery. Whenever i click that arrow symbol, one lookup window will get opened. Data in that lookup window will come from some another table.
I want to select multiple values from that lookup window and want to assign all those values to that text field.
How can i do that?
Please help.
If you go to the Budgets form, to the G/L Account filter, when you click the arrow, select more lines, click OK, there will be Filter entered, which include all the values, you selecte... you can be inspired with this...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I saw the code. When i click that arrow values selected by me will be stored in one variable and those selected values will be displayed in the matrix box. Am i right?
But what i want is whatever values i select those values should get stored in the table field.
e.g
Suppose my table name is Customer and it has one field named Segment then wheneve i select multiple values from that lookup table all those values should get stored in Segment field of Customer table.
Please help.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
So when i click on command button lookup table will appear and i will select the multiple values from it.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
RIS Plus, LLC
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
RIS Plus, LLC
I will provide one command button next to the text field. Then PushAction property of that button will be set to RunObject and RunObject property will be set to Table table_name . Now in that table i will have two fields, one will contain the data that i want to insert in the text field and second field will contain checkboxes. so when i click on that command button , lookup table will appear and then i will check those checkboxes whose corresponding first field values i want.
Can i do this?
if yes then how. i.e. Which trigger should i use? How can i find out which checkboxes are selected?
Please help
Code in form:
It will include all values which you (user) select - all blue records...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Now i am able to select the multiple values. But one problem is there.
I am assigning selected multiple values to one variable. Now how can i transfer the value of that variable to a field of a table.
I have written following code for that. No error is there but value doesn't get transferred from variable to field in a table.
segval:=segcode.getvalue(); // segval is a variable
searchin.OPEN(18);// table 18 contains the field to which i want to assing value
searchin.NEXT();
searchinfield:=searchin.FIELD(2);
searchinfield.VALUE(FORMAT(segval));
COMMIT;
1. COMMIT not mandatory
2. You have to "save" the record after modification with searchin.MODIFY
2) you must call MODIFY to save modifications... do not use COMMIT if you have no necessity ... (as HalMdy wrote...)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Thanks.
Now instead of writing a code can i do the same by setting property.
i.e. can't i directly assign value of the variable to the field, by setting the SourceExpr and TableRelation property so that i need not to first find out the correct record and then to insert value of variable to a field.
RIS Plus, LLC
(without going through a loop and without using recordref.next())
Thanks for any help.
RIS Plus, LLC
Thanks.