Easy recreation of "Shared, Desktop Private on 1st use" views - view

I have some views that uses #UserName in the selection formula. For working that, the view must be "Shared, Desktop Private on 1st use". That is no problem.
But this views are going to be redesigned quiet often.
As this is a bunch of views it is very uncomfortable for the user to delete each of this views to recreate from scratch with design changes.
I try different things to get that done with an agent but no one is fool-proof and give some strange results (sometimes even do not update the design).
Best result so far is to delete the icon from the workspace and open the application again. That works (until now) always. But this is so annoying for end users to reopen the app from the (deep leveled) server folders.
Any other method to update the design of "private on 1st use" views ?

As you noticed, private views are a pain to maintain. Why not go a different way to solve your problem?
Create a categorized view, where the first, categorized column contains the field you compare the username in your current solution to.
Than embed that view into a form as a "single category embedded view" and use #username as the category.
Presto. Now you have a view that only shows documents for the current user and you can change the design whenever you like.
Mick Moignard has a good article on that topic online: Dynamic view filtering in Notes.
See also the Lotus Domino Designer Help, Topic "To show a single category in embedded views"

I have tried to solve the same problem and ended up doing two things - (1) automatically send the user an email with a link to the database and ask them to remove the database icon so that the private views get deleted and (2) alert the user when the design of a private view has changed.
The first part was fairly simple - I wrote a LotusScript function that would send the current user an email message containing a link to the current database (the one that contains the private views), along with some meaningful text and database information. All the user had to do then was exit the database, remove the database icon, open the email they just received and open the database again using the link. No need to navigate the server folders or wonder which server to go to. This can be used on its own, e.g. in a button, but I ended up combining it with something a little more tricky.
The second part was devising a way to alert the user that the design of the view they are opening is outdated. The tricky part was detecting that the design of the view has changed. What made this possible was what actually caused the problem in the first place - the fact that Notes caches the private view. When caching the private view, Notes also caches constants that the script in the view events refer to, that are part of LotusScript libraries the view uses.
Here's a description of the design I used:
Let the view use shared script library, PrivateViewsCode.
In PrivateViewsCode's (Declarations) declare Const DESIGN_VERSION = "1.0".
In PrivateViewsCode declare function myQueryopen. One of the parameters myQueryopen receives is string designVersion.
In the private view's Queryopen event call myQueryopen, passing DESIGN_VERSION to designVersion. Since this code is in the view that is cached, DESIGN_VERSION will contain the constant value as it were in the moment the view design was cached (when the user first opened it), in this case - "1.0".
In myQueryopen compare designVersion to DESIGN_VERSION.
Dim designChanged As Integer
designChanged = (designVersion <> DESIGN_VERSION)
Since myQueryopen is part of PrivateViewsCode script library, here you actually compare the DESIGN_VERSION (as cached in the private view and then passed to myQueryopen) to DESIGN_VERSION from PrivateViewsCode, which is always current.
The only thing left is to be sure to recompile the views (Tools\Recompile all LotusScript) after changing DESIGN_VERSION.
I hope this explains the design, here is how it works:
After making changes to private views design you change the version:
DESIGN_VERSION = "1.1"
Recompile all LotusScript.
Refresh the database design.
Users open any private view that uses this functionality.
They get a message saying they will receive link to the database and that they have to remove the icon from the workspace and open it again using the provided link.
The user closes the database and removes the icon - private views are deleted.
The user opens the database link in the email, the next time they open one of the private views, the new design is cached along with the new value of DESIGN_VERSION (here, "1.1").
The comparison (designVersion <> DESIGN_VERSION) now yields false. Everything is back to normal until the next update.
Ken's way of handling this has the major advantage of not involving the users at all. This wasn't an option for me because of the frequency with which I made changes to the views (the application was just deployed and I had many requests for changes to the views) as well as the big number of private views in the application.
(Edit)
I assumed you had a specific reason to use private views, but I used the "Show Single Category" in an embedded view (just as leyrer suggests) ever since it became available and was quite happy with it. If you see any limitations to using the "Show Single Category" option, I'll try to help you with that.

I found a way that moves the pain from the end user to the developer. I designed the navigation to use outlines so I can control where the user goes when they navigate to a view. Notes outline entries can be changed without the user needing to go through the delete-icon-then-reopen-database hassle.
When I need to update the design of the private view, I rename it as well and also update the reference to it in the notes outline entry. At the users desktop, when they next open the database, a new private view will be created for them. Most (or all) of my users never noticed anything, at least they never mentioned it!
The process is fairly easy for the developed but also fairly easy to forget. Also, the user's workspace will end up having a lot of references to old unused private views, which if they are large in size might become a problem down the line. If you change the view twenty times, or change twenty views, for example, it may be time to delete the icon to clear them out. For me the changes were rare enough for this not to matter.

The solution to your dilemma is not too hard to solve, but a little tedious. There is a technote on simply removing private views programmatically. It is a common design issue for developers.
I have had to take the following approach to manage multiple private views which were all going through multiple versions at any one time.
The secret is to do a check on the DatabaseOpen event, as it's a view held on the local client so you need to do this through user's UI activity. As long as your Lotus Notes client fleet is at running version 6.5.x you could try the following. To be concise, I have outlined what you need to do.
Name your private view "yourPrivateViewName_1.0|yourPrivateViewName"
Note the use of an alias. This is so you can reference the view in an outline or code, no matter how many versions you use.
This can also be a multi-valued field if you have more than one private view to manage.
Create a database profile document that has a field with the current private view name, eg "youPrivateViewName_1.1"
On DatabaseOpen loop through the views, finding the private view(s) then compare the name to the one in the database profile. The naming convention is designed to make it possible to do a version check. If the versions don't match, remove the view. When the user opens that view the next time it should grab the current version you have released.
There are other ways as well, like checking the timestamps on the private view and the template, but it still requires a way to single out the private view. But I found this way easy enough to manage.

Thank you all !
I finally ended up with the following:
Create an Agent running from menus that close the database
Sub Initialize
Dim s As New NotesSession
s.SetEnvironmentVar "remove-"+s.CurrentDatabase.ReplicaID,"1"
Dim ws As New NotesUIWorkspace
ws.CurrentDatabase.Close
End Sub
In the database close event mail a database link and send keys to remove from workspace
Declare Sub keybd_event Lib "user32.dll" (Byval bVk As Integer, Byval
bScan As Integer, Byval dwFlags As Integer,Byval dwExtraInfo As Integer)
Sub Queryclose(Source As Notesuidatabase, Continue As Variant)
Dim s As New NotesSession
x = s.GetEnvironmentString("remove-"+s.CurrentDatabase.ReplicaID)
s.SetEnvironmentVar "remove-"+s.CurrentDatabase.ReplicaID,""
If x="" Then Exit Sub
Dim ws As New NotesUIWorkspace
Call ws.AddDatabase( s.CurrentDatabase.Server,s.CurrentDatabase.FilePath)
Dim m As New NotesDocument(s.CurrentDatabase)
m.From = s.CurrentDatabase.Title
m.SendTo = s.CommonUserName
m.Subject = "Link to open " + s.CurrentDatabase.Title
Dim rt As New NotesRichTextItem(m,"Body")
rt.AppendText s.CurrentDatabase.Title
rt.AppendText " -> "
rt.AppendDocLink s.CurrentDatabase,"Open Application"
m.Send False
Delete m
keybd_event &h2e,0,0,0 ' Del key down
keybd_event &h2e,0,2,0 ' Del key up
keybd_event &h0D,0,0,0 ' Y key down
keybd_event &h0D,0,2,0 ' Y key up
End Sub
(You all got your upvotes but a i mark as answer for the lowest rep. points user.)

Related

Modifying graphical elements with PL/SQL - Oracle Apex

I am currently trying to migrate Forms' Applications developped ten years ago to Oracle Apex. For some context, the database in which Forms applications are currently running is the Oracle EE 6i, and will be soon upgraded to the 12.2g, hence the need for migration. The data stored within the tables is to big to migrate (like 4To) so we need an alternative to Forms, but we cannot change the DB, and cannot keep Forms (which is let's be honest, outdated a little). I am currently on Oracle XE for my tests and on Apex 20.2.0.00.20 to start my migration (before upgrading).
The thing is, I have some issues with how Apex and Forms are working differently.
I am really blocking on the following issue since my migration:
In Forms, it was really easy to change the color of a button for exemple by calling a Forms method in a certain way depending on a condition (for exemple a SELECT return). Here, in Apex, I am trying to do the same.
I know that there are ten other ways of doing the same, with JS for exemple which I already succeedly do, but when I tried to create my second appplication I realised that compared to Forms, Apex cannot reference/generalise parts of the code(or applications) for different applications (and certainly not for different workspaces). So Javascript is a good solution but not as efficient as PL/SQL which is easier to generalise and will (in my opinion) use less exchange between the db and the client, since stored on the db.
That is why I decided to rely on PL/SQL Stored Procedure which will be specified in the database and called directly in each application where I need the process/computations.But I cannot find the same as in Forms, with my graphical methods helping me do what I need.
I am open to alternative of PL/SQL package/procedure/function if it can keep the same propreties (generalisation and minimum echange between client and db). These are important point since I have around 200 applications to migrate, starting with what we can call 'brick' which will compose the other simpler applications.
Btw: CSS is an option I studied, like HTML with PL/SQL dynamic content but I read that it was either not simple enough to integrate, or that it could be deprecated, so if it is the solution you are using, I could use a really detailled explaination or an exemple.
To give you an instance:
I click on a button triggering a PL/SQL stored procedure
Procedure checks some conditions in the db (like if a process is currently running)
PL/SQL update a table, change a variable in procedure and returns 'green'
The button becomes green, a message is displayed ('You have permission to do this!')
PS: if there are Apex Method modifying the graphical aspect, could I have a documentation ?
Thank you a lot for helping me resolve this issue, I have been stuck for days...
I tried Javascript bu the generalisation was too much a problem. I tried the HTML injecting but didn't work, I tried updating CSS but was not what I expected. I tried different PL/SQL method but couldn't find a way to connect PL/SQL with Apex/CSS/HTML...
It takes a bit of getting used to how APEX works, but everything can be done and once you get up to speed, you'll find there pretty simple ways to get things done. To achieve what you describe, this is what you'd do.
Create a dynamic action on click of button
Add the following actions to the dynamic actions
an action of type "execute pl/sql". This is your "Procedure checks ...". In this pl/sql code you can set page item values (make sure to reference those in "items to return" so the new values is set in the session. There is no reason to have 2 different pl/sql procedures, you can just put them in 1 block. This procedure would return the "green" - but more about this later.
an action to add a class to the button under certain conditions.
Note that the "green" is not something you should decide. In apex, there are a lot of layout modifier classes pre-defined. In your case, it makes sense to use the "success" modifier (which happens to be green).
To check how you want the button to look, there is a tool called the "button builder", you can use that to see what classes you should add/remove to change the look of the button.
Note that 20.2 is not a recent version. It was released in 2020. Since then 4 more releases have been made available: 21.1,21.2,22.1 and 22.2. It is advised to be on the latest version.
Here is a basic example. I have a page with a select list (P117_SELECTLIST), a hidden item to hold the button status (P117_BUTTON_STATE) and a button (MYBUTTON). The select list has 2 static values:
The dynamic action for serverside code is :
Note the items to submit and return values. P117_SELECTLIST is submitted so the pl/sql process picks that up from the client and P117_BUTTON_STATE is returned to the client so it is available for any future use.
Then I have 4 classes to set the button style. One to add success class, one to remove success class, one to add warning class, one to remove warning class. Below is the first one. The only think different in those 4 actions in the class name and the client condition. It can probably done with javascript directly as well with only 1 action.
I'd strongly suggest to update the db version to a version that supports the latest version of apex. It will save you a lot of development worries. Most people of forums only have the latest version available.

swift : display info to a users (first use) and then disappear

I would like to display some info on the screen ... which will disappear.
Example : an Uiview is displayed for the first time to an user (or feature never used by the user). I would like to display on a screen a label or an image to explain how to use this new feature. After that it will disappear ...
If this functionality has already been used by the user, the message is ofcourse not displayed.
example of message --> to add a gamer, press +
How to do that ? a lot of apps have this kind of help.
thanks
What you have to do is actually very simple : have a persistent variable, and change its value. Each time the user could see the help popup, you check the value of the variable you stored persistently. If this variable indicates that the user have already seen the help, you don't display it again. Otherwise, you show it. Simple example:
let helpSeen: Bool = getVarFromPersistent()
if helpSeen == false {
// DISPLAY THE HELP MESSAGE OR POPUP
setHelpSeenVar(true)
}
Where getVarFromPersistent() and setHelpSeenVar() are function you could create to respectively retrieve the variable from the persistent data and set the variable in the persistent data.
Now, you have to figure out how to use persistent data. You can have a look at CoreData, that is provided by Apple and "ready to use" in Xcode. You've probably already seen the use core data tickbox when you create a project.
Third party libraries exists as well like RealmSwift, who reached version 1.0 recently.
I'm not an expert, but I think Realm is simpler to use than Core Data. The technology used by the two libraries could be different though, maybe someone else could tell you more about it. Anyway, you will find a lot of article about Realm and Core Data on Google.

vb.net data set not working

I am using two different datasets to populate datagridview my project using visual studio using vb.net. It is windows forms application which is used to display information from the database based on user inputs. Once the information is displayed the user can save the information into a table specifically created to store the report information in order for it to be recalled at a later date. I am now trying to recall this information so have created my dataset in the same way as before and am now trying to invoke a new occurrence of it and this is where the probelm begins. The code is below.
Dim dv2 As New System.Data.DataView
dv2 = New System.Data.DataView(DataSet2.Tables(0), "Status <> ''", "",
DataViewRowState.CurrentRows)
DataTable2TableAdapter.fill(DataSet2.DataTable2, f5.ComboBox2.SelectedValue)
I am getting two issues.
For DataSet2.Tables(0): Reference to a non-shared member requires an object reference
For DataTable2TableAdapter: ’DataTable2TableAdapter’ is not declared. It may be inaccessible due to its protection level.
I dont know why this is happening as I have written the same code here as for my previous data set other than changing the SQL statement behind the dataset at set up. Any thoughts would be welcome as I am totally out of ideas. All questions are welcomed.
Thanks
Try the following code to fix your error number 1....
Dim tablezero as System.Data.DataTable
'
tablezero = DataSet2.Tables(0)
The reason your getting the error is because you are trying to access an object (Table(0)) and it is not visible to the code that is trying to access it, if it was SHARED then it would be visible.
So you can resolve it by defining and object instance/reference to it and then accessing that reference, which in this case i have called "tablezero" (or by making table(0) SHARED - usually not the best bet unlessits neccesary - no point in having something accessible to the whole class it is declared in unless absolutelty neccessary)
It is quite possible the second error may dissapear after just fixing above, then again its difficult to tell without your code for Dataset2
Hope it helps.

Changing Views in a Module pops me into the Admin Skin

This question has probably been the most covered question in all of DotNetNuke's lifetime but I'm going to ask it here in StackOverflow because I need an answer, a really good one that doesn't make me look the other way. Thanks in advance to all DNN experts.
I've researched many ways of making this work for me and i've seen Michael Washington's solutions (Panels, MultiViews, ...) and Will's (Strohl) blog post on DotNetNuke's personalization engine through setting SkinSrc which is useful, as well as reading through Default.aspx's code which has given me more insight, however, i'm still faced with the problem that calling EditUrl()/NavigateUrl() brings me to a page with a single module in admin skin or a page with nothing respectively.
The specific version is DotNetNuke 6.0.1 (DNN). This Module has 4 other views in addition to the main view which I desire to navigate through sequentially. e.g.
Begin Checkout -> Collection of Delivery Details -> Confim Order
Have you found a solution?
I want to achieve
1) Module loads with other modules around. No module isolation
2) Views in a module that don't Preload e.g. Page_Load in each view gets called when the Module loads up
Help!
Assuming you are asking this as the module developer, the solution is to not use DNN's mechanism for specifying a control. So, you can't use EditUrl or specify the ControlKey in the NavigateURL call (which both generate "ctl=mycontrol" in the URL). Instead you need to have your module display your various controls based on the Query String parameters. So, you'll generally have a control in your module who's primary purpose is to dynamically load other controls based on the query string. So, for instance:
You will start with your control that lists items. You'll have a "Buy Now" button for each item. The hyperlink for each item can be generated by calling
NavigateURL(TabID, "", "View=BeginCheckout", "itemid=" & id, "mid=" & mid)
2.) On the page load of the handler control, it looks to see if anything is specified for the "View" Querystring parameter. If not it displays the listing control, if so, it displays the corresponding control.
Dim controlPath As String
Dim path as String = "~/DesktopModules/MyModule/Controls"
Select Case Request("View")
Case "BeginCheckout"
ControlPath = path + "BeginCheckout.ascx"
Case "DeliveryDetails"
ControlPath = path + "DeliveryDetails.ascx"
Case "ConfirmOrder"
ControlPath = path + "ConfirmOrder.ascx"
Case Else
ControlPath = path + "ItemList.aspx"
End Select
If System.IO.File.Exists(Request.MapPath(controlPath)) Then
placeholder.LoadControl(controlPath)
Else
Throw New Exception("Unable to load selected template. Please go into module settings and select a list and details template.")
End If
Most of the advanced modules for DNN do something along these lines so there's plenty of sample code out there. I would guess some of the core modules do something similar. I adapted the code above from Efficon's Articles module for DotNetNuke.

Get a list of Active Directory Users along with their Full Name and Email

I need to retrieve a list of Active Directory users and their attributes using Delphi 2010.
I've seen a few similar questions on SO (e.g. Delphi - Find primary email address for an Active Directory user), but they all seem to require the user name before any additional information can be retrieved.
I had written an article for [The Delphi Magazine] way back when..... if you have access to a backlog of those magazines, it's in issue no. 62 (October 2000) - unfortunately, it seems those back issues aren't available for purchase anymore :-(
It's too long of an article and a code sample to post here.... basically it's about wrapping the IDirectorySearch interface in a nicer Delphi-like shell. You pass in a base container where to search, you define an LDAP filter, and you define a set of attributes you're interested in - then you search and get back basically an enumerator for the results, which you can get one by one.
In the end, I discovered TJvObjectPickerDialog, part of JVCL. It wraps the Windows Select Object dialog and does everything I need with very little coding. Just set the required properties and call execute. The selected user objects are returned along with the attributes that you set in the 'Attributes' property.

Resources