HTML

Syndicate content 5 

or "Bonus Breakage"

In our last lesson, we added a relationship between 2 persistent classes.  We are clearly going to need to start creating REST Services to expose CRUD operations for each of these classes, but before we do that, we should really finish defining our linkages.  We added code to our Widget toJSON to spool off related Accessory data, so we should really do the reciprocal and allow Accessories to return all Widgets that are compatible.

The code we can use is essentially the same as we used on the Widget side.  We will iterate over the bridging class and return the toJSON of all referenced widgets.  We are definitely sure we have a toJSON for the Widget class, so we shouldn't be expecting any errors.  We add the code to WidgetAccessory and compile, before loading our service in the REST debugger to make sure everything is spooling OK

Last comment 24 September 2018
+ 3   1 2
462

views

+ 3

rating

I am using &html<> to output some CSS to my page (which is a class-based and not a tag-based page), and the selectors contain the '>' character which the compiler chokes on.  How can I escape the '>' so it still displays as such in the web page source but doesn't trip up the compiler?

This is for 2012.2 btw.

Last answer 20 November 2015 Last comment 20 November 2015
0   0 2
257

views

0

rating

or "Didn't you say you would cover Persistent Objects in Part 5, Chris?"

Yes, that was the plan.  This is a pretty important topic, so it get's its own Article

Up until now, we've display widget JSON that has been created by a basic loop.  Clearly this isn't of much value.  Now we have our stack connected together, and we can see that the data is flowing to the Welcome page, it's time to complete the stack and start feeding our service from "real" data.


Let's start with our (very basic) Persistent class for Widgets.  We have 4 properties to hold Name, Description, Price and current Quantity.  We would like to expose all of these on our page.

Last comment 4 July 2018
+ 2   0 3
712

views

+ 2

rating

So, one day you're working away at WidgetsDirect, the leading supplier of widget and widget accessories, when your boss asks you to develop the new customer facing portal to allow the client base to access the next generation of Widgets..... and he wants you to use Angular 1.x to read into the department's Caché server.   

There's only one problem:  You've never used Angular, and don't know how to make it talk to Caché.

This guide is going to walk through the process of setting up a full Angular stack which communicates with a Caché backend using JSON over REST.  

Part 1 - Setup

To start fresh, we will create a Namespace for our new application - WIDGETDIRECT, and set this up with Code and Data databases, and appropriate Security roles.  

Our next step is to set up 2 Applications to serve web content; one for the Angular web content and one to serve the REST conten

Last comment 3 July 2018
+ 14   0 6
2342

views

+ 14

rating

In our last lesson, we implemented a new REST Service to allow us to perform CRU operations on Widgets, and refactored our Controllers to allow the page setup to be decouple from the content.

When we created our Widget Services, we did not implement a Deletion operation, which the HTTP Delete verb provides.  As this is a base table for other parts of the Widgets Direct empire, we don't want to be able to do a hard Delete of the WIdget values, as this could cause issues with our ordering and billing modules.  So, we will add a "Deleted" property to the class, and have the Delete operation set this Boolean flag instead.  We will adjust our GetAllWidgets method to ignore any records which are marked as "Deleted"

REST.Widget

Last comment 2 March 2018
+ 3   0 6
513

views

+ 3

rating

I would like to write some code to parse a set of HTML pages from the internet in order to gather information from each web page.

All of the web pages are generated using a template, so the format of each of the web-pages is consistent with one-another and the information that I want to gather is always located in the same logical place within the page.

What is the best way to parse an html page in order to gather information at a specific place?

Can XML XPATH be used here?  Does anyone have any examples of parsing HTML content?

 

Last answer 1 June 2016 Last comment 15 December 2017
+ 2   0 2
780

views

+ 2

rating

Hi all-

We used to have this Java applet in our CSP page to "print all" and "download all" PDF medical reports.  We want this applet so that the user won't have to open each PDF in the browser just to print it.

But now most browsers do not support Java applets anymore due to security concerns, so that Java application is down.  We tried to migrate to Java Web Start but don't know how to invoke the JNLP file from the CSP page.  I am new to Cache so any help would be greatly appreciated.

Also, is there an easier solution to this print all problem?  I assume many hospitals/labs would be facing the same issue, so there might be a smart hack?

Last answer 29 September 2017 Last comment 29 September 2017
0   0 2
376

views

0

rating

or "Things are going to break"

We left our application over the weekend, secure in the knowledge that it was returning data from our primary persistent class, User.Widget.  However, Widgets Direct are the premier supplier of both Widgets AND Widget Accessories, so we should really start working on adding these Accessories to our application. 

We should do some housekeeping first though.  Our Page Controlller code is currently sitting in the widgetmaster.js file.  As we start to build up our application and use multiple controllers, this will make the PageController hard to find, so we should refactor it into a sensible location and file name.  So let's create modules/page/PageController.js under our web application, and paste the code in there.  We can then remove the controller code from widgetmaster.j

Last comment 5 June 2017
+ 2   0 0
576

views

+ 2

rating

I need a trick to display the cellTitle for just ONE column in a tablePane with a unique value.  Here are the issues:

1. OnDrawCell has access to the cell data for that row/column, in %query(pName),  but setting the cellTitle property to a column doesn't refresh the column object

2. Setting showValueInTooltip is good for the entire table, not just one cell

3. ** the column element does not evaluate zen expressions, so I can't say cellTitle="#(%query.Comment)#", for example.  That's the crux of the problem.

 

Last answer 23 May 2017
0   0 3
0

comments

191

views

0

rating

In our last lesson, we added some formatting and validation to our Edit Widget form.  So, now we are ready to add the ability to add new Widgets to our application.  However, the great Widget Wars have come to an abrupt end, as Widget Direct has purchased its biggest competitor, WorldWideWidgets.  In order to maintain some continuity, we need to display their catalog on our new application.

So, we have good news and bad news.  The good news is at that WorldWideWidgets also use Caché, but the bad news is that their Widget table has different properties with different names than our Widget class, and we need to keep the catalogs seperate for the time being.  WorldWideWidgets don't have a WidgetAccessory catalog (and they wonder why they lost the Widget War), so we don't need to worry about Accessories for no

+ 2   0 2
0

comments

307

views

+ 2

rating

In our last lesson, we added a form to Edit our existing Widgets, and save them back to the server.  However, our Form was not well structured and our Save button had no intelligence, and was not fully visible.  So today, we will apply some Material components and Angular style to make the form more useful

Let's open EditWidget.csp, and make some changes.  First, we want to change the component from an md-card to an md-dialog.  We then want to wrap the content in a div so we can set the layout to "column" so the controls display in a vertical list, and also a Form which enables Angular to verify the state of the form

+ 2   0 4
0

comments

306

views

+ 2

rating

We finished our last lesson with our Widgets Direct page iterating over a list of widgets, displaying an ID and a Name value.  While we have been able to achieve this with only a small amount of coding, the page itself is not the most visually appealing place to be.  The AngularJS framework is providing a powerful Model-View-Controller framework for our structure and logic, but it does not implement anything that will provide a nice UI experience.  For that we need to implement a UI toolkit.  We have numerous options here; the leading toolkits are BootStrap from Twitter and Angular Material from Google.  There are advantages and drawbacks to each choice.  It is well worth exploring demos of each toolkit to see which would fit your need

Last comment 25 April 2017
+ 6   0 5
750

views

+ 6

rating

At the end of our last lesson, we ended with our page displaying a nice (but garish) Angular Material Toolbar, and our Widget data displaying in a list of Material cards.  Our page feels a bit static, and we already know that the large number of Widgets that we will be dealing with will not be especially usable on a static list.  What can we do to help?


A filtering function would be very helpful, so let's add a text input to the top of the page. We will bind this to a variable in the $scope - widgetFilterText so that Angular has access to the value we type in. We will also wrap the whole page content in a div and set layout="column" to have the new text input and the existing cards arrange vertically on the screen

+ 3   0 0
0

comments

504

views

+ 3

rating

We finished our last lesson with our Widgets Direct page receiving a Welcome message as a property of a JSON object, which was unpacked and displayed on the page. However, we are on Lesson 3, and we still haven't had any talk of displaying widgets yet.  

Let's change that.  Widgets Direct are a leader in widget and widget accessories, so we clearly have numerous items to display.   To transfer this, we will need to declare and return our first array.  Let's go back to our REST.Dispatch class, and add this data to our Service

+ 4   0 5
0

comments

699

views

+ 4

rating

or "So you just got yelled at by your boss, for sending him an unformatted Hello World webpage"

Our previous lesson ended with us serving a Message value obtained from a Caché REST service to the client, using Angular as a runtime.  While there is a lot of moving parts involved in this process, the page is not especially exciting at the moment.  Before we can start adding new features, we should take a step back and review our tools.


This tutorial is using the JSON functionality built into 2016.2+ versions of Caché.  This functionality is partially available in 2016.1 but utilizes a different syntax which will not be forward compatible.

+ 11   0 6
0

comments

1063

views

+ 11

rating

Hi everyone, I have and Zen Mojo application, it's all working but I have some doubts about what is recommended to use: There is some reports of employees, for example, and actually I'm using some plugins : "Excelent export" to generate Excel reports and "jspdf" to generate PDF reports in client side.

I have an REST service, that receives the request, process and returns JSON, after client side receive the response it's processed.

- This can be slow/bad in applications with large data?

- It's better/recommended to use ZenReports even with ZenMojo applications?

- Or Zen Mojo, like any other applications based on HTML, JS and PHP can support this with any problem?

- The preparation of the JSON is very fast because the use of %DynamicObject and %DynamicArray; ZenReport can be slower than it?

 

Thanks,

Andrei L. Nenevê

Last answer 24 February 2017
+ 1   0 0
0

comments

193

views

+ 1

rating

I have a web application with html, css, js files (no ZEN/CSP).

Problem: after I update them on a server, Caché still servers old and cached version (browser Cache is disabled).

There is a manual cache purge in Gateway Settings, of course, but is there an automatic solution?

I'll be okay with disabling cache server-wide, but an application-wide solution would be better.

I don't want to host web app on a separate web server.

Here's my web app config:

Last answer 10 February 2017 Last comment 10 February 2017
0   0 0
642

views

0

rating

If you spend a lot of time working with javascript, json and html and you are new to Eclipse / Atelier you may like this tip. 

 Instead of the default Atelier HTML you can install a JS plugin for eclipse which works quite good handling javascript files, allowing you to see functions, color syntax, etc... The one I used is the JSDT. The JavaScript Development Tools (JSDT) provide plug-ins that implement an IDE supporting the development of JavaScript applications and JavaScript within web applications. It adds a JavaScript project type and perspective to the Eclipse Workbench as well as a number of views, editors, wizards, and builders

+ 2   0 2
0

comments

291

views

+ 2

rating