+1
Answered

What type of databases can be used on a local level?

Luska72 11 ár síðan updated by icahill (Administrator) 11 ár síðan 1
Hello,
I was wondering what type of databases can be used on a local level. I know that XML can be used if you have it in your root folder and if you do res://(Name of database), but can I have a local JSON database? If not is there anyway to write/delete data from the xml database?
Thank you for your time,
-Ryan
XML and SQL can be stored locally and called using res://. You can't update a local XML file, but you can create a SQL database on the fly. More info on that here: https://studio.rarewire.com/wordpress...

If you are set on json, one solution you can consider using is to create a second datasource (one json must still be external) and then use the 'add' object property to populate this new json from your external source, which will then be stored locally. This would then leave you the ability to update this local json with new data at any time, but should reduce load time on rotate. This json would be local, but would not display inside your project as a visible file similar to creating a SQL on the fly.
See info on add in the object properties section here: https://studio.rarewire.com/wordpress...

Example:
<httpheader name="redBox-header" Accept="application/json" /> <datasource name="redBox-default" source="" httpheader="redBox-header" query="/Products/Movie" providertype="json" urlcacheduration="43200" datasourceerror="redbox-error" /> <datasource name="redBox-movies" source="" query="/Products/Movie" providertype="json" /> ..... <assign property="datasource:redBox-default.source" value="https://api.redbox.com/v3/products/movies/default?apiKey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&amp;pageSize=100&amp;pageNum=1&amp;includeComingSoon=false" /> <assign property="datasource:redBox-movies.add" value="{ &quot;originDataSourceIndex&quot; : &quot;[var:inventoryIndex]&quot;, &quot;Title&quot; : &quot;[datasource:redBox-default.[var:inventoryIndex].Title]&quot;, &quot;productId&quot; : &quot;[datasource:redBox-default.[var:inventoryIndex].@productId]&quot;, &quot;BoxArtImage&quot; : &quot;[eval: JSON.parse(&#39;[datasource:redBox-default.[var:inventoryIndex].BoxArtImages/link]&#39;)[1][&#39;@href&#39;]]&quot;, &quot;ReleaseYear&quot; : &quot;[datasource:redBox-default.[var:inventoryIndex].ReleaseYear]&quot;, &quot;MPAARating&quot; : &quot;[datasource:redBox-default.[var:inventoryIndex].MPAARating]&quot;, &quot;RunningLength&quot; : &quot;[datasource:redBox-default.[var:inventoryIndex].RunningLength]&quot; }"/>


Another solution is that you could store JSON data inside of a texttemplate directly in the WIRE code and run it out that way, though this is a more static approach.