Project file:C:\Users\Demo\Desktop\TechForum2017 Mappningar\Rest\CRUD_Read.EDS
Date and time for documentation: den 5 december 2017 15:47

SOURCE file
File type: SQL
TARGET file
File type: JSON

table group: SQL

Container typeNameData typeMapping
virtualExtract Id from metadataSingle occurance
select[Order]Single occurance
virtualCheck Order IdSingle occurance
declareArticleMax occurrences (2)JSONDoc.Articles

declare: Article

Parent: SQL
Container typeNameData typeMapping
columnIdvarcharJSONDoc.Articles.ArticleNr._value_
columnQuantitybigintJSONDoc.Articles.quantity._value_
where
WHERE [Order] = : orderid

virtual: Check Order Id

Parent: SQL
Container typeNameData typeMapping
edi-c codecode
if(SQLSTATE != "00000")
{
	argv[9] = "404";
	sErrorResponseBody=readfile("C:/Users/Demo/Desktop/TechForum2017 Mappningar/Rest/404.html");
	sErrorResponseBody = replace(sErrorResponseBody, "$$orderid$$", orderid);
	//sErrorResponseBody = "404 - Not Found\r\nOrder with ID '" & orderid & "' not found";
	return 0;
}

select: [Order]

Parent: SQL
Container typeNameData typeMapping
columnSendervarcharJSONDoc.Sender._value_
columnReceiveddatetimeJSONDoc.Received._value_
where
WHERE Id = :orderid

virtual: Extract Id from metadata

Parent: SQL
Container typeNameData typeMapping
edi-c codecode
integer iTable = tableload ("table1",argv[8] , ":");    
string  url = tablematch (iTable, "X-Inobiz-URL");
string orderid = filename(url); //Picks up the last section separated by "/"


element: JSONDoc

Container typeNameData typeMapping
element (_value_)SenderSingle occuranceSQL.[Order].Sender
element (_value_)ReceivedSingle occuranceSQL.[Order].Received
elementArticlesMax occurrences (99999) : complex typeSQL.Article

element: Articles

Parent: JSONDoc
Container typeNameData typeMapping
element (_value_)ArticleNrSingle occuranceSQL.Article.Id
element (_value_)quantitySingle occuranceSQL.Article.Quantity


Mappings