I am building a product in which customers can create dynamic form depending upon their requirements. For example one customer can create a form having fields like first name, last name, others can have one extra field like middle name.
I want to store each and every customers settings and finally i want to merge these two settings into one form at the time of display to our end users. I am finding right way to implement it.
Finding a way to store individual customers settings either in Database or XML or anything.
Finding a way to merge customers settings into one form, once our end user select both customers to apply (i want to give only one form which contains both customer form fields).
Please remember that i am providing a tool where customer can create new label like Gender, which is not defined in the system. We are giving generin data type to create such fields using text box, text-area, table, check-box, radio and many more.
Please assist me to design the architecture of above problem set.
You can do this by modelling your database as Entity–attribute–value model. See this :
Using Database Metadata and its Semantics to Generate Automatic and Dynamic Web Entry Forms
Planning and Implementing a Metadata-Driven Digital Repository
You can also find useful threads here in SO in the tag: eav
Related
I'm working on a webapp at the moment that will display a list of items. The list is dynamic and can change between users. A great analogy is to think of the objects as books, with the db backing it as the library.
My database for Book will contain a list of all books in the library.
-A user can add a book to their collection.
-If a user wants to add a new book to their collection they will also add it to the library.
-If a user wants to add a new book to their collection and it exists in the library, nothing will be added to the Book database.
Currently my table is incredibly simple: Book(id, name). I am able to access a plethora of information about these books via an API call, such as a front cover, number of pages etc etc. I would like to store a subset of this information, especially the image url.
I think a sensible approach would be to alter my Book table so that it looks like: Book(id, name, imageUrl, otherValue, idOfThisBookInApiCallTable) the idOfThisBookInApiCallTable value will allow me to get other attributes as I need them, however I've two issues with this that I'm not sure on how to proceed.
Firstly is that this Table can easily get out of date with the APITable. I don't expect there to be much change, if any, but the risk is there.
Secondly, the image being stored is my main concern, on a page where there might be 50 books, I'll making a call to the url of the image each time. I think a sensible solution would be download the image locally and then serve it from then on repeated visits but I'm not sure if this is the correct approach.
Might I ask if anyone can see any issues with this approach and/or suggest a better one please? I have limited experience with db/web/app design so a little out of my depth here.
If saving the image locally is the correct approach, is there a 'best' way of doing this?
Thanks in advance for any help/suggestions/advice.
I can share my 2 cents of a plausible design but I think the question is too broad and is mostly opinion-based. Let's address it by taking one thing at a time.
First regarding your Book table. Why not a Library table where you maintain the current state of your library with all the books that the library has at the moment.
Each user can hold a collection (a table etc with a one to many relation like user_id to list of book_ids or whatever) and then each user sort of owns a subset of bookIDs.
When adding a new book via user or via library (library can also add more books even if no particular user brought it in) then always add it to the library and if the user_id is known for the 'owner' of this book, add a relation for this user as well in the collection table
More details of a book can be stored separately in a BookDetails table.
Storage of images on your side is always a nice option and you don't want to get blocked by the API for over-usage when requesting over and over again. You can use some cloud storage like s3 where you can keep the images and then not bother the external api. S3 supports compression and caching so you can save lots of time and not have speed problems.
All the above points are just my opinion based on the information you gave on the question. The situation can of course be different for your use-case.
I am a tester in a Scrumteam trying to automate our test regressionset.
Our front-end is developed in Java Angular and we use Tosca testsuite to automate our testset. The problem I am encountering is as follows:
With Tosca you can scan the application and all the fields, atributes, divs, and so on are shown to the user. The moment I scan one of our datatables I see them as what they are: a table. However, every field/button/icon/etc is being scanned as a seperate object.The table has 1 body, but the individual rows are not found. Meaning that the rows within the tables are not identified.
This makes it impossible for me to perform an automated search on a table, because the rows and therefor the colums are not identified, only the header is.
Anyone ever encountered this issue with a testtool or found a sollution how to fix this in the coding of the front-end in Java Angular?
This is a common scenario when the application under test is developed using UI Libraries, where the complex controls (e.g. Table, Combobox etc.) are rendered not as a single HTML tag (<TABLE> for Table or <SELECT> for combobox). Instead you will find bunch of other HTML tags (<DIV>, <SPAN>, <TABLE>, <UL> and what not!)
If I understood correctly, there are two ways to automate this scenario -
You mentioned that you are able to find a <TABLE> tag (The header). There good
chances that each row in the table is itself a <TABLE> and that's
why you are not able to see all the contents in a single one (you
can cross check this in the Content View section of XScan
window). If you just need a single row for verification (I am just
assuming!), you can select any one of them and use ConstraintIndex to get to the right row data. You can also look for a parent control (basically another <TABLE>) which clubs all the child table. This parent table might show all the data in one place. Table Verification will work with this control. Please remember that it is
just a workaround and might not fit into your scenario.
You can write a custom control to handle this. Custom control is a way where user can define how a control looks like. Once you implement this, Tosca will be able to recognize the table as a single control containing all the data. For more information on this, check the Tosca API reference here
In my play app I'm trying to offer the user the oppotunity to edit a specific item he selects from a table by clicking on a button in the same table row as the item.
To be more precise the user will edit the students that have enrolled for an exam. After clicking on the exam he wants to edit a modal will open. Inside the modal a table will show all available students with a checked checkbox for students which are already enrolled.
My only problem is: How do I pass the modal the id of the exam the user wants to edit? As far as I've researched I cant't define and edit variables inside of the template. In Angular I would just modify a variable in the scope.
What is the correct way to do this?
The general principle of moving initialization data from the back-end to the front-end is to inject it into the markup someplace, using the templating engine. In your case, in whatever loop you're using in your template to render the table rows, you simply drop the ID in it's own cell in the table, in a class or id attribute, or maybe most appropriately, in a data- attribute on the table row. I would say each of these options is pretty much equivalent, mostly differing aesthetically.
Then, in your click handler, you just use a relative selector on the event target to pull the ID into your script, wherever you stashed it.
The other approach is to render your table on the front-end, pulling this information from the back-end via API, in the style of a single-page app. Then, that association between ID and data lives in the model before its even rendered. This may be overkill for this one example, but if you've got rich interactivity with a dozen of these sorts of screens, I think this is a much more scalable approach.
I have a login page i.e index.jsp which is having 3 fields:
1.> Usertype select tag (it include admin, emp, proj. co-ordinator, proj. manager)
2.> Username textbox
3.> Password textbox
Login button
Now the issue is I had different table for different users (admin, emp, proj. co-ordinator, proj. manager) with their username and password.
So is there any step wise procedure to validate multi user login using servlet and jsp.
I m successfully able to run for single user (like for only username and password) but unable for multi user.
Suppose in controller you get usertype in variable type, then you can manually create query and fetch the result from db like this :
String query = "Select * from "+type+" where <Your condition>";
But This is really bad idea to do this. Instead you should look at inheritance in db. and I guess this will help you to restructure your database.
Why this is bad idea?
Lets suppose you have 3 type of user currently in your system say : admin, employee and user.
Now after some time, if you need to add another type of user in system say HR, then what steps you have to perform:
1) Create another table for HR with same duplicate columns.
2) Change your logic in java files for HR user.
3) To scan the whole project for the same effect if you have hard-coded the query.
And benefits of inheritance in db:
Just insert the record in db with type = "HR" and you are done. Isn't is quite simple?
And FYI :
Advantages:
Simple approach.
Easy to add new classes, you just need to add new columns for the additional data.
Supports polymorphism by simply changing the type of the row.
Data access is fast because the data is in one table.
Ad-hoc reporting is very easy because all of the data is found in one table.
Disadvantages:
Coupling within the class hierarchy is increased because all classes are directly coupled to the same table. A change in one class can affect the table which can then affect the other classes in the hierarchy.
Space potentially wasted in the database.
Indicating the type becomes complex when significant overlap between types exists.
Table can grow quickly for large hierarchies.
When to use:
This is a good strategy for simple and/or shallow class hierarchies where there is little or no overlap between the types within the hierarchy.
In your case most probably there are two approahes
1)You can manually create query as said above
2) You can create a table which contains usertype(it include admin, emp, proj. co-ordinator, proj. manager) and its concerned table. So at controller when you get required info
But that will be a overhead and for new usertype you have to create anew user. So add it would be better if you have a single table which stores username and password of all and for user type you can add new column.
So I'm creating a program that auto generates forms for data entry. The form is created by a user (its a simple table setup with the ability to merge cells). Some of the cells contain text views, others contain text inputs (all based on how the user draws it).
This form is then sent to another application that draws it back out. I was wondering what the best method is to represent the form. I though either use XML to represent the form or use a database that would basically function as a grid and row 1 column 1 in the database would match the form cell row 1 column 1 and so on (kind of an odd way to use a database).
The form creation program is made in C++ and the form regeneration program is created in Java.
Is there an even better way to do this?
Thanks,
I am also thinking the same thing because I am in to creating dynamic forms for my framework to. So I will share some thoughts with you. Using database to add new forms like adding a record in one table that specifies the form and its fields in another having the ability to select it's field types to, or creating one table for each form and each time create a new table or altering its fields (sound messy).. or create a folder with a bunch of xmls that are used for the structure of your forms?
When it comes to database:
Your application is stricted with a specific database application
like sql server 2008 or mysql or mysqli or oracle etc.
Your application is causing network traffic, not that bad but it is
doing it eveytime you need to create or use a form.
You need a panel that creates those forms using the database, and
can be accessed if its web even from your mobile.
When it comes to XML:
Your application is free from database version restrictions.
you need the impersonator to have the right to create files in a
spesific directory in your frameowork.
You don't need a panel even though you can create one, because XML are human readable files. So you can make one while eating your dinner and serve it to your system,
and wala, you have your form generated.
These are my thoughts for now.
How about the methods that will be used in the form? will those also be dynamic? How can you specify what calls what? this is also what you need to take in account.
I think that XML is a much better choice here. Using database as a grid could be more of a headache than needed. You will have to deal with all the problems related to having the database and not really get any benefits of the database. The industry decides to go with xml more often than not as well (xbrl being one example).