Webservice with and temp Table

stony
Member Posts: 122
Hello,
I have a page, which displays the Lot Numbers (as a list) to an article. This page gets the data via a function in the page, because the page has set the property SourceTableTemporary to Yes. The SourceTable is Lot Number by Bin Buffer.
The OnOpenPage trigger calls the local function FillTable, which inserts the data.
The article number is transferred with another function (ParameterSet) and this is then used in the FillTable.
This works inside Navision perfectly!
Now I want to use this page as a web service. How can I transfer the article number so that the Lot Numbers list is created only for this article number.
Thanks,
stony
I have a page, which displays the Lot Numbers (as a list) to an article. This page gets the data via a function in the page, because the page has set the property SourceTableTemporary to Yes. The SourceTable is Lot Number by Bin Buffer.
The OnOpenPage trigger calls the local function FillTable, which inserts the data.
The article number is transferred with another function (ParameterSet) and this is then used in the FillTable.
This works inside Navision perfectly!
Now I want to use this page as a web service. How can I transfer the article number so that the Lot Numbers list is created only for this article number.
Thanks,
stony
0
Best Answer
-
Each web service call is a separate session, so remembering values global vars or single instance codeunits won't work. You have to pass the requested value in the same call which is supposed to retrieve the data.
The solution proposed by @allenyyzhou have all chances to work. First, try to make your "Article number" a flowfilter in your table. If it still doesn't work try moving the code and add some code in OnFind. Perhaps something like thisOnFind(Which : Text) ArticleNo := GETFILTER("Article number") RESET; //may or may not be needed IF ISEMPTY TEN FillTable (ArticleNo); EXIT(Which)
(Note I did not try this myself either)
Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-036
Answers
-
Hi
Just an idea, you add this "article number" as a field into your source table.
Before you get data from the web service, you can set filter to "article number", and inside the page, you can Getfilter of "article number", then clear filter, insert data.0 -
Where in the page I can read this filter and delete it again.0
-
Hi
Sorry, I have not try this, but could you try in the OnOpenPage trigger?0 -
Unfortunately does not work0
-
Each web service call is a separate session, so remembering values global vars or single instance codeunits won't work. You have to pass the requested value in the same call which is supposed to retrieve the data.
The solution proposed by @allenyyzhou have all chances to work. First, try to make your "Article number" a flowfilter in your table. If it still doesn't work try moving the code and add some code in OnFind. Perhaps something like thisOnFind(Which : Text) ArticleNo := GETFILTER("Article number") RESET; //may or may not be needed IF ISEMPTY TEN FillTable (ArticleNo); EXIT(Which)
(Note I did not try this myself either)
Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-036 -
I tried making this work the other day, but without luck. (Odata)
Couldn’t find a trigger that worked.
I solved it with the real table and som flow fields for the needed data.
So maybe we are stuck on soap and xml/codeunit for this scenario???
Or if you can compose a query instead.Follow me on my blog juhl.blog0 -
Late to the party but perhaps helpful to the weary internet traveller:
Can confirm the suggested solution of @allenyyzhou works for NAV365 / 14.
If you create a page based on a temporary table, publish it as a webservice and require to fill it with a custom function you can pass variables to OnOpenPage as a filter in the ODATA query f.e.
http://nav365:7048/NAV/ODataV4/Company('CRONUS')/CustomCustomerPage?$filter=No eq '1005'
You can use GetFilter("No.") in the OnOpenPage to retrieve the filter (1005) value. Be sure to call Reset() as suggested to clear this and any other filters if you don't actually want them applied.trigger OnOpenPage() var Customer: record Customer; begin if (Customer.GET(GetFilter("No."))) then begin //Retrieve filter value Reset(); //Clear filters SetPageData(Customer."No."); //Call to the custom function to fill the temp table end; end;
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions