Create record via client script in a relation model in App Maker - google-app-maker

Could someone point me to documentation that shows how to create a record in a model with one to many relation via client side script.
Thanks in advance!

There are two ways of creating a new record.
1. Via a client-side script
You can do this by calling a createItem function from a widget. This link might help with that.
2. Via a server-side script
You can do this by directly creating a new record, assigning it to the relation of a model and then saving that model. This link might help with this method. By the way, it's easier to do this in a server-side script, as the guide itself says.
Since you just requested the link to official documentation, I've limited my answer to links only. Please feel free to ask if you need clarifications!

Related

How to enable web users to interact with a REST API

Hi and thank you for looking into this.
(Disclaimer: I have little-to-no technical background and would like to find the least complex solution. Ideally, only "connecting" different out-of-the-box components and no coding.)
HIGH-LEVEL PROBLEM:
I have trained a model for text classification using Google AutoML. I want to make this model available on a website, ie I want to enable visitors to enter their text and to receive the model's predicted class.
CONSIDERATIONS SO FAR: AutoML allows us to deploy the model via REST API and I understand that what I want are the API's PUT and GET function (right?). Ideally, I would use some form of plug-in or script to create an input field for the user which accepts the PUT and then delivers the GET.
Are you aware of any services for this? I'm also happy to host the website in an content management system like WordPress.
I'm very open regarding other approaches to solving my problem and highly appreciate any constructive input.
Many thanks!
AutoML Documentation https://cloud.google.com/natural-language/automl/docs/predict
EDIT Jan 10 There is another question related to this and a depo is shared which supposedly provided a solution. I'm not able to access the depo but the question might help you to understand my issue. Is there a way to use Googles AutoML with JavaScript?
EDIT Jan 16 I have learned that in order to provide the input to the model the POST function could be used instead of the PUT.

edit profile page for useraccounts:bootstrap

I am pretty new to meteor and I am trying to make my first app which should have a profile page, later also with picture upload depending on user group.
As I understand I do not need a extra collection and subscription.
I am using useraccounts:bootstrap package with accounts-password. I added some custom fields to the profile (firstName, lastName, country).
Now I want to create a update or edit page. I could not find any resources which could been helpful.
Do I need to write all the logic for example testing the email address by my self? Or is this included by the package.
Or is it better to create a new collection for users with meteor-collection2?
Thanks
Witali
Collection2 will just attach its schema to the original user collection (if you proceed like suggested in collection2 readme).
As far as I know, I'm afraid that you will have to create some publications. Since editing user should be considered as "must-be secure", I would advise you to take a look at the existing packages. I'm quite a newbie to so I didn't look into the code of alanning roles package (which is, I've been told, excellent).
I used https://github.com/perak/user-roles. I think the code is good and clear.
The same guy, perak, made a meteor code generator which is still a work in progress, but looks very promising to me. Get one of his examples with user account and look at the client folder. You will have, when considering his user-roles package, all the code to do what you want.
ps: for email testing, look at his files in the client/lib folder but it is just a regex

Is it possible to publish/subscribe to a remote api instead of a collection in MongoDB?

I would like to retrieve Data from a remote api (via HTTP.get) and pass it to the client. Currently I manually poll the data and implemented some template helpers, that pass the data to the views.
In case of a jquery datatable I use the jquery-datatables package and that needs a published collection.
Has anyone a hint for me how to implement this?
Just for others who might want to know how to solve this:
You'll find an example here: https://github.com/avital/publish-time/blob/master/publish-time.js
The code is shown in this 20 min video: https://www.youtube.com/watch?v=onCkNRE2q0c
With that you'll be able to quickly implement custom publish/subscribe without using MongoDB.
#richsilv: Thanks again for pointing me to the right stuff.

Web API Help Samples - C#

ASP.NET Web API has an easy install Nuget help page with sample generator. It's easy to get it to generate and display sample requests, but not so easy it seems to get it to display sample responses (httpsampleresponses) so that when developers look at the help page they'd see examples of generated responses / not static/typed in responses, but actually generated. I've seen it done before on another project, but still having trouble figuring out how to do it. MSDN's YAO has a good blog but it's just not getting me all the way to success for some reason.
From what I've seen work live and based on what there is to read about it online, it's definitely in getting the HelpPageConfig file right in terms of the config.SetSampleResponses() set up. I've discovered the configuration file that sets the parameters for the SetSampleResponses() method, but still, nothing I try is working. It was suggested to me that I should create a custom type and use extension methods, but getting that to correspond and display what I need hasn't happened yet. I can get it to compile without errors, but it still doesn't show the generated response sample on the page. It was easy with the SetSampleForType piece to get a section to show up in the requests section, but it's the response part that has given me trouble.
Has anyone out there done this with the SetSampleResponses() successfully and is there any kind of trick you can clearly define for getting it to work? Do you have any tips on setting up a specific generic type and making that work?
I'm thinking this must be something really simple and I'm just not clicking to make it happen....
Thanks for any potential info...
SetSampleResponse extension on HelpPageConfig is for statically defining samples for you action.
config.SetSampleResponse("\"Hello World!\"", new MediaTypeHeaderValue("application/json"), "Values", "Get", "id");
if you are looking for generated sample for a particular type, have you tried using SetSampleObjects extension which allows you to set sample objects for different types and this same object is used in all cases where that particular type is returned from an action.
config.SetSampleObjects(new Dictionary<Type, object>
{
{typeof(string), "Hello World!"}
});
Could you share more specific(code) details as to how you are using SetSampleResponse extension?

Crystal Report Best Practice Question

I have got a task regarding parameter passing to Crystal Report via Crystal Report, I would like to find best way to achieve it.
Imagine that I have got parameterized and non reports-parameterized. I am developing a report manager that will enable users to subscribe to the reports and schedule them with their parameters. I have got a subscription web page with the list of reports. When a user wants to subscribe to a report and schedule it, if there is no parameter in the report, it is fine but if there is any parameter that needs to be passed to the report(which we can find from rpt file), user should be able to enter these parameters values via a panel in the page. and I will save those parameters' values to the database.
Effectively, I need to create a parameter entry panel to get the parameters and save them to the database with their type, value and so on, then I need to use these parameters programmatically for exporting reports to the different file formats.
Basically, I must develop parameter entry panel run time in accordance with the parameter types that the corresponding report has.
Does anyone have any idea what the best way is to achieve it?
Thanks for your help from now on and please ask for further clarification if needed/
Kind Regards.
You could use BusinessObjects Enterprise, but that will be expensive.
Otherwise, you will need to build your own parameter control. The control would interrogate the report, determine what types of parameters that it contains, then build the control's UI accordingly. It would need to maintain state between post-backs, capture and display the default values and current values collection for each parameter.
I started building such a control a few years back, but never completed it. It's quite a bit of work as you might guess.
In a comment on you're question you asked what would be suggested instead of Crystal Reports so I figured I'd offer up SSRS. If you are using SQL Server, I'd recommend that you look into using SQL Server Reporting Services. Though I believe that Crystal Reports are more robust (possibly just because I know them better), I believe that a lot of the subscription, scheduling, and parameter handing is ready to go after the initial configuration.
I'm not an expert on SSRS so maybe someone with more knowledge will edit my answer with more specific details. Hope this helps.
You can open each report as a ReportDocument object, then enumerate through the ParameterFields collection to evaluate the names, types and other info on each. With that info you can generate your parameter entry panel.

Resources