Hello everybody
I have a little question, can I realize a TableRelation in my C/AL Code ?
Because i want to make TableRelation with condition IF. I have tried SETFILTER and SETRANGE without success.
Thanks in advance
Arnaudā
Hello everybody
I have a little question, can I realize a TableRelation in my C/AL Code ?
Because i want to make TableRelation with condition IF. I have tried SETFILTER and SETRANGE without success.
Thanks in advance
Arnaudā
Can you provide a bit more detail of what you are trying to accomplish? Possibly and example.
I have a Dynamics NAV Module for material allocation request.
In this module i can select material from resource Table.
Resource table with an additionnal column which is āAvailableā a boolean.
I want to display in my request module only the available products.
So what you need is to set a filter in a page to only display Resources with Yes in Available? Or?
If yes, then Resource.SETRANGE(Available,TRUE) would do it.
Yes but it doesnāt works
I have put resource.SETRANGE(Available,TRUE) in the OnOpenPage trigger of my Allocation Request card page.
Ok, then letās take a step back.
Please letās know which version youāre working on, which page type. And is the source table of the page the resource table?
Iām on the version 2013, itās a Card TypePage. The source is a custom table.
Iām working on the 2013 version. My page type is Card and the source table is a custom table.
Hi
Please set a filter in Table filter or plese type the following in table filter field Available=FILTER(Yes)
Thanks
Marshal
Thank you. And is the āAvailableā field a field on this custom table?
No, Available is a field that I have add to the Resource table. Thatās why I have create a C/AL Globals (Record)
Ok then I understand your frustration!
And what is your plan in regards to the Resource table? Do you have a field where you want to enter the Resource No. from the Resource list, but only display Resources where Available = Yes?
If yes, then normally you would create a code type field in your custom table. Here you need to set the table relation on that field to something similar to:
āResource WHERE (Available=CONST(TRUE))ā
Yes thanks Erik, but I want to do that in C/AL because i donāt want to apply this any time.
I suppose i must use FILTER ? But it doesnāt works.
So the please tell me exactly what it is that youāre trying to do. Step by step in details.
Hi There,
You can use a record variable , filter records you wish (Same as filters you need in table relation) and then pass the record variable to the page and run the page in C/AL Code.
In the Page where you want to input use a unbound field and upon successful validation pass the value to actual field (bounded field)
You can find similar examples in NAV in Sales , Purchase , INV reservation and Manufacturing modules.
Hello Erik,
the step are :
I have a Card page
In this Card page, i can create a request for material allocation
In this request, user must choose a resource (material).
This resource can be available or not
That i want is to only display available material in field āMat. No.ā (Material are from Resource table)
Thanks in advance
Arnaudā
And one last question. Is the āMat. No.ā control an actual field in your table or is it just a variable defined on the page?
Mat No. is a field in my custom table (which save the request)
Ok good.
Then go back to my reply where I suggested you to insert this filter on your custom field:
āResource WHERE (Available=CONST(TRUE))ā
That should solve your problem. If you want to set the table relation manually, then you specify this filter in the Table Filter:
The only potential problem I can see is if the field Available is not a normal field but a calculated flow field. Then itās a bit more advanced to do this.
Yes, Erik but as i said i want to make this restriction by C/AL because i donāt want to apply this restriction all the time.
I want make this restriction cover by an IF condition. I have already tried this TableRelation and it works but itās not really answer to my expectation.