0

I don't want to use the native data structure of 2sxc. I want to link the module with my own custom table. I don't see how to do that from its settings.

1 Answers1

1

Your question could mean different things, so let's split

  1. you may already have data in a SQL which you want to use to visualize etc. A common example is when you have data from external systems synced in, or if you have data from another module which doesn't have awesome templating. In this case you can easily use it - explained below.

  2. you may wish to have a completely different data structure because you somehow prefer that, and wish to use 2sxc to edit data in sql tables. This is not possible ATM because 2sxc has so many features incl. data versioning, multi-language etc. which would have to be worked around in custom data structures, so the (default) 2sxc-edit experience cannot work with standard sql tables. In this case, you could still use 2sxc to run razor-files and web-apis - like to have your own js-edit-experience and mainly use 2sxc as the container. But it's probably not a common scenario.

Using SQL data in your templates - easy, many options.

  1. if you are using the visual query designer, there is a sql-data-source. This can run a select against your table and provide the data to your templates, to json or wherever you need it. Check out http://2sxc.org/en/blog/post/new-2sxc7-dnn-sql-datasource
  2. if you just want razor and sql, this is also easy to do - see the demo app here: http://2sxc.org/en/apps/app/sql-data-access-demos
  3. if you want other code samples, check out https://2sxc.org/en/docs/Feature/feature/2579
iJungleBoy
  • 5,325
  • 1
  • 9
  • 21
  • Thank you - You have covered visualization well. However what about a CRUDE interface for the data. An example: I have a simple articles table (ID, Title, Content) - Can I hook it up to 2sxc and be able to edit, delete and update data? – Aderson Oliveira Feb 19 '17 at 14:59
  • That would be type #2 in the answer above. This is not possible ATM because 2sxc has so many features incl. data versioning, multi-language etc. which would have to be worked around in custom data structures, so the (default) 2sxc-edit experience cannot work with standard sql tables. In this case, you could still use 2sxc to run razor-files and web-apis - like to have your own js-edit-experience and mainly use 2sxc as the container. But it's probably not a common scenario. – iJungleBoy Feb 21 '17 at 07:21
  • ...but if your current table is primarily the initial data, you can easily import it into 2sxc - check out https://2sxc.org/en/Learn/Import-Export – iJungleBoy Feb 21 '17 at 07:21