K2 Blackpearl - populating SmartObject attributes - k2

I'm very new to learning how to use K2 Blackpearl and am trying to understand how to effectively use SmartObjects.
Basically I have a list of questions I want to ask a user so currently I've created a smartObject with 2 attributes (Question, Answer). I have a list of all the questions I want to ask stored in a SQL server db.
Is it possible to auto-create either an InfoPath form or as ASP.NET page (At this stage I'm not too bothered which one I use - just want to see something working so please feel free to recommend which one is easiest) which will get the questions from the database and auto-create the 'fields' which the user will need to place an answer to the question... Then save this back to the smart object?
Thanks in advance for any help, much appreciated!

I see this question is very old and the suggestion of using InfoPath was probably good back then. For the record, as of today, InfoPath is no longer the recommended option.
Today, using SmartForms, I would create one SmartObject (smo) for your question/answer table (assuming there is a single answer per question, one table it enough). In your table, don´t forget colums to store whether the question is answered or not, by whom and when.
I would then suggest making 2 views: one list view to see all the questions and one item view mainly to answer a question.
When the user clicks on a question in the list view, you load it into the item view. The user can type/select and answer in the item view and click a button to 'send the answer' which effectively calls the update method of the smo.
This is s standard pattern, similar to listing updating users or pretty much any data in your DB. You just need to think about your data model to ensure you won´t stuck later on.

InfoPath is easiest to go, there's no real development, just clicking.
You can use a smartObject on the SQL database (using the Dynamic SQL Service Broker) to get the questions and load them in the InfoPath form. On the submit of the form, you can push the questions and answers to the SmartObject.
I would suggest making the 'answer' smartobject also based on a sql table, so you're data is nicely placed together.

Related

How do I use wit.ai with existing rows of data?

I have a lot of existing data that I would like to use as training data for a wit.ai chatbot. The data is stored in a csv file where each row has a statement/question and a response to that statement/question.
I know that wit.ai requires you to assign intents to comments made and so I'm wondering if there is a way to simply send over the data I have and have the chatbot start learning intents on its own.
Thanks!
Thanks for posting. We know this is not perfect yet but we release an import/export feature a few days ago. Looking at the structure of the json export, one can probably easily feed with existing data. It would require creating one story per statement/question and a response. More info here:
https://wit.ai/docs/recipes#copyexportversion-my-app
"Teaching" Wit.Ai is not exactly what some might think it is.
You will have to create stories for your User says column. The replies are irrelevant to be honest. You can't "teach" wit.ai to reply. Replies are defined in the story or in your code.
What wit.ai might need from your data are keywords and key-phrases which make the entity recognition better for wit.ai.
Here is the simplest example:
Entity color is recognized based on keywords listed. So if you have a lot of data as an example of user input - you can try to break it down first into "which entities which user input should produce" and then keywords from those input.
Using your data for "teaching" - would be a little difficult since it will require you to create a lot of Stories in wit.ai to cover possible user input and entity identification. But you can still do it like this:
(rough example)
Make one story about user asking the time for example
Mark in the user input which entities should be derived from that input:
Sort your list you have to get all possible way of asking for the time:
How late is it?
Can you tell me the time?
I wonder what's the time now?
Use a script (Python) to "shoot" all these user inputs at your story.
Once done - go to Understanding time of wit.ai and go through all input correcting\adding the entities you defined.
This process will "teach" entities if they are keywords based or some other algorithm.
That's the best I can think of about how to use your existing data. Wit.Ai is different from other language processing tool-sets and "teaching" it with existing data is somewhat "puzzling" :)

Yelp API displaying data

I've been looking up and down and there doesn't seem to be much documentation on this. I am just beginning development, and have no prior programming experience aside from HTML which doesn't really count.
I am able to successfully pull data with URL queries as I can see in my console. My question is, if I wanted to send a query for restaurant reviews, as an example, how do I get that data from the console to the iPhone view, right on the screen? If someone were able to provide a simple example I would appreciate it.
I'll give you the general steps:
1) Parse the JSON (which is probably an array of dictionaries) so loop through the array with an inner loop iterating the dictionaries. You could also use JSONKit.
2) Optionally cache the data somewhere (NOTE: If you use core data, there is a nice NSManagedObject method that will basically create an NSManagedObject directly from JSON).
3) Display it using UIKit (i.e. a Table view, where each cell displays the text and images your are retrieving).
If you need any specific help with any of those steps, please post new questions as you go along -- Break it down and tackle one problem at a time.
Also, if you use Core Data to persist this JSON data, you could use the NSFetchedResultsController as the datasource for your table view, which simplifies that some too.
I know you probably wanted me to write the code for you, but you've asked a very ambiguous question, whose scope is really too broad. If you follow those steps and have specific questions, we will help you work through it as you go.

Zend Table relations saving / updating

Currently I'm working on a cms page module where I need to update pages after made some modifications on for instance the text. Because I'm getting multiple data from several tables, I also need to save / update the data to multiple tables.
Updating data to one particular table isnt a problem, but for some reason I cant figure out how to do the same trick with table relationships. One of my questions is how to do this and if you maybe need to create a single savePage method for every model and handle the particular data seperately. Or is their a better solution to handle the saving with options like ManyToManyRowsets.
I'm not sure if its me searching for the wrong thing or if the thing I want, just doesnt excist. Anyway, the following link seems to look a little like what I want. If someone could help me out, I would be very thanksfull.
https://stackoverflow.com/a/640648/1553963
this post should answer your question (there is no easy way) and provide you with an how to too:
Zend Many to Many Relationship
Lucian

How to make sure a bounded form and subform in MS Access only submits to the database after a button click?

A little information about the problem, I am fixing an old Access database that has a form bounded to a table "tblMain" and the subform is bounded to a table "tblSub" and the relationship between tblMain to tblSub is one to many, where tblSub has a field called belongs_to which is the id field of the record in tblMain that owns it.
So the main form holds one record and the subform holds many records that are tied to that one main record.
Is there any way for me to tell the two forms to wait to update to the database until after a button has been pressed?
There is no easy way to do what you are asking for. It basically comes down to use unbound forms and manually handling the inserts/updates.
I think you could possibly do this with an ADO recordset that is opened using adLockBatchOptimistic but I don't have a concrete answer on this.
I recommend you stick with the default behavior of MS Access or consider developing your solution in .Net where batch updating is the default behavior.

Lotus Notes how to get a calculated value from another form using formula language

I have Lotus Notes application, deployed only as modifications (new forms, views, and adding a button to one of the "standard" views) in the main mail template (R7).
All these "new" forms and views are inherited in turn from my main application template.
Now, for one of these forms to function properly, it have to have a field, which is different from customer (not end user, but organization) to customer.
I do not want to break the inheritance from our template, so we can update the application easily by just sending a new template. So, I can't ask the client admin just to break the inheritance for this particular form, as it will stop all updates (or they have to be done manually).
So, let's say I have MainAppForm, which has a calculated field ClientCustomData. I'd like to have another form, which only has only one "default" field ClientCustomData. I can break the inheritance for this second form, as it has no really design elements which may change, and then the client can modify this default value to whatever they need w/o fearing that it'll be overwritten.
The question is - how from MainAppForm I can read the value from the other form?
Or - is there a way to store 2 data elements only in a mail template (I dunno, shared file, or something), so it becomes available to each user, and MainAppForm can get them, w/o a need to remove the inheritance dependency of MainAppForm from our template.
I can envision even a class library with just to functions to return this (I don't know why this approach smells to me).
Any best practices or advices?
I'm not sure if I have understood your querstion correctly, but it sounds like you want to have a small part of a larger form configurable per client. If this is the case, I think computed subforms could do the trick.
Consider the following scenario: Your application ships with the subform ClientCustomData that contains just sensible defaults for the client settings. The form MainAppForm includes this as a computed subform. It is then possible for the local admin to disable inheritance on the subform and changing the custom data without affecting inheritance on MainAppForm.
The obvious drawback is that you cannot update the ClientCustomData subform automatically once inheritance is disabled; Keep this subform as small as possible. If you find that you need more client-custom values, you can always add another subform in the same manner.
First a clarification: In Lotus Notes, you don't have forms reading from other forms. Forms are just UI objects. However, you do have back-end and front-end documents that get created with the help of Forms.
When you create a new document based on a form (for instance, a new email), you are creating a front-end document that hasn't been saved yet. That document can access other parts of itself or it can access any back-end document that has been saved.
If I'm following you correctly, you need some bit of data that is different per client/customer to be brought into documents based on MainAppForm. There are a few ways to do that. My suggestion is to use Database Profiles, which are special documents that can easily be accessed from anywhere in your database via Notes Formula language or LotusScript. Granted, you can't push data within those documents out via a template, but if you use a database profile to store your database settings your client admin can set options once and they won't get altered when the template changes.
Have a look at the #SetProfileField and #GetProfileField functions.
To answer my own question (still I do not know if I'm right in terms of Notes way of thinking, but looks promising):
I found the "Shared fields". So, I create 2 such a fields with a computed values (the ones I want to pass on), and make my MainAppForm use them. Upon installation, the admin will change the values and mark them to not refresh with the template.
I'd respect any pros and cons, provided from a Notes expert.
Thanks