![]() ![]() Get the list item that corresponds to the uploaded file by using the ListItemAllFields property of the uploaded file.Ĭhange the display name and title of the list item by using a MERGE request.īoth code examples in this article use the REST API and jQuery AJAX requests to upload a file to the Shared Documents folder and then change list item properties. #UPLOAD A FILE AND PLAY USING ARRAYSYNC API CODE# The first example uses SP.AppContextSite to make calls across SharePoint domains, like a SharePoint-hosted add-in would do when uploading files to the host web. As we saw in Chapter 1, defining a model in TensorFlow.js involves creating it layer by layer using the Layers API. The second example makes same-domain calls, like a SharePoint-hosted add-in would do when uploading files to the add-in web, or a solution that's running on the server would do when uploading files. For our exercises, we will use a mix of models we will design and train, pre-trained models, and ml5.js models. Provider-hosted add-ins written in JavaScript must use the SP.RequestExecutor cross-domain library to send requests to a SharePoint domain. To use the examples in this article, you'll need the following:įor an example, see upload a file by using the cross-domain library. Write permissions to the Documents library for the user running the code. If you're developing a SharePoint Add-in, you can specify Write add-in permissions at the List scope.īrowser support for the FileReader API (HTML5).Ī reference to the jQuery library in your page markup. 'use strict' var appWebUrl, hostWebUrl jQuery ( document ). ![]() #UPLOAD A FILE AND PLAY USING ARRAYSYNC API CODE#.#UPLOAD A FILE AND PLAY USING ARRAYSYNC API HOW TO#.One would be the REST Source Synchronization, the other one would call PL/SQL code to maintain the child tables. Then create an APEX Automation, which runs on your desired schedule, and this automation has two Actions. You could turn off the schedule of your REST Source synchronization, and have it only running when called with APEX_REST_SOURCE_SYNC.SYNCHRONIZE_DATA ( ). ![]() Handle child table maintenance in APEX itself. I would simply delete and re-insert LINES rows. Insert into SOTEST_ORDER_LINES_LOCAL ( order_id, line_id, line_number, product, quantity, price) Here's some pseudo-code on how the trigger could look like.Ĭreate or replace trigger tr_maintain_linesĪfter insert or update or delete on ORDERS_LOCAL The nice things about this one is that the maintenance of the child table is independent from APEX or the REST Synchronization it would also work if you just inserted rows with plain SQL*Plus. You could create an trigger on your ORDERS table, which runs AFTER INSERT, UPDATE or DELETE on your ORDERS table, and which maintains the LINES table. So would I need to write a function that runs every time there is new data being merged?Ĭreate a trigger on the local synchronization table The REST data is being synchronized to make a request every hour. Where exactly do I write the SQL? Would I write it in SQL Workshop in SQL Commands? So per Carsten's answer in the previous question, I can write SQL to extract the JSON array from the LINES column in the SOTEST_LOCAL table to the child table SOTEST_ORDER_LINES_LOCAL. ORDER_ID /fk SOTEST_LOCAL references ORDER_ID REFERENCES "SOTEST_LOCAL" ("ORDER_ID") ON DELETE CASCADE ENABLE "PRODUCT" VARCHAR2(200) COLLATE "USING_NLS_COMP",ĬONSTRAINT "SOTEST_ORDER_LINES_LOCAL_PK" PRIMARY KEY ("LINE_ID")ĪLTER TABLE "SOTEST_ORDER_LINES_LOCAL" ADD CONSTRAINT "SOTEST_ORDER_LINES_LOCAL_FK" FOREIGN KEY ("ORDER_ID") I should've named the tables as ORDERS_LOCAL and ORDER_LINES_LOCAL) CREATE TABLE "SOTEST_ORDER_LINES_LOCAL" I then created an ORDER_LINES child table to extract the JSON from LINES column in the SOTEST_LOCAL table. As you can see below, the LINES column contains the JSON array. The order attributes have been synchronized to a local table (Table name: SOTEST_LOCAL) The lines array has been manually added to a column (LINES) to the Data Profile, set data type to JSON Document, and used lines as the selector. The Row Selector in the Data Profile is set to "." (to select the "root node"). ![]() Data is being extracted via APEX REST Data Sources. Summary: I have an API returning a nested JSON array. This question is a follow up to another SO question. ![]()
0 Comments
Leave a Reply. |