Dynamic access to database table

Hi,


I am working on an application that will be used for different functionalities with same environment and database, so I need to segment data depending on functionality.


Regrettably, data segmentation on tables is not enought for security requirements, I need to query data from different entities depending on functionality dinamically (on run time).
I am trying to use a variable, of type dataStoreEntity, to set entity which query on in each case. I know that dataStoreEntity type has an ID to represents the entity, but i don't know how get it.

Is there any way to define the value to set on variable on run time? It's possible to get the ID of an entity, for example, by entity's name?

 

  Discussion posts and replies are publicly visible

Parents Reply Children
  • Hi Mike and Harrison,
    As far as I'm understanding, the application will create different types of data while running and this information has to be segregated in different entities (tables).
    This can be easily with stored procedures, that is, a stored procedure creating a new table and storing there the segregated data. New tables will follow a name convention: segregatedDataTable_1, segregatedDataTable_2, ... Peanuts.
    I have quite examples of this in Java Apps.

    BUT, can I in Appian create a constant dynamically to reference the new tables? And once i have that new constant, can I add dynamically tables to the DS ? and then, can I update the new created constant to the new added table?
  • 0
    Certified Lead Developer
    in reply to jordib
    Tables in the DB require data stores to access via Appian query functionality (versus direct SQL which is not a very good practice in general), and I don't believe there's any out-of-box functionality to create data store entities dynamically or automatically at all. I would suggest you find a design approach that works within the constraints of Appian's database table / data store architecture.
  • Yep, Vikram response seems to be the one to follow...
  • Dynamically creating new tables on the fly won't work for Appian, as you won't be able to automatically create the associated DSEs. Why do you need new actual tables? Is this an actual customer requirement? You could add a type column to your table, and then instead of splitting data by literally making new tables, you just give the data a different type. You can then only show users the appropriate type of data.