Add/Remove joined Table from Clarion View using PROP

Maybe, but the need is really quite simple. I have a single table that I would like to add or remove as an inner join to the view based on a user setting. Browse template generates the basic view just fine.

Typically, I have declared an alternate view in code and set which is used in the ResetQueue method of the Browse Class. This requires some coordination in maintaining code to declare two similar (90%) views - one by the templates, one in an embed. Being able to change a base view using PROP would likely prevent bugs down the road as the app evolves.

Your current approach with alternate view declared in embedded code is quite well for the purpose.

One can use {PROP:JoinExpression} or {PROP:SQLJoinExpression} to specify a condition to link joined tables. But unfortunately, it is not possible to add or remove a joined (SQL) table from a Clarion VIEW using Clarion property assignments. Even SV Dynamic File Driver does not work with Clarion VIEW structure.

I know this matter very well, two decades ago I created a classes allowing to create Clarion structures (GROUP, QUEUE, FILE and VIEW) dynamically at run-time. These classes have been used internally in my applications only and never released commercially to public.

As for the {PROP:Join}, it has nothing to do with Clarion VIEW structure.

PROP:Join EQUATE(7CE2H) ! boolean: Join < > buttons

The JOIN attribute (PROP:JOIN) on a SHEET control specifies the TABs display all on one row instead of multiple rows, no matter how many TABs there are. Right and left (or up and down) scroll buttons appear together at the right end (or top) of the TABs to allow the user to scroll through all the TABs.

1 Like

Alternatively you can left that table Joined on the File Schematic but as a custom-join (left outer) : 1=0

Then programmatically change the join expression and INNER condition, for example on Brw1.Open after parent call:

Brw1.View{PROP:Inner,JoinedTableNumber} = 1

Any reason why you never released it commercially or in the public domain, it sounds useful, but I’me sure there are some caveats.

Thats a nice solution and certainly helps with the template embed reuse. Maybe a bit of column formatting ie 0 width columns could help as well.

Thank you. I suspected this was the case. PROP:Join on a SHEET likely predates Clarion views.
The concept itself seems possible (given what is already in place) if SV so desired.

CPCS Reports template has a “Handcoded View” option to design any VIEW with any supported JOIN logic (from files in the DCT but without relationships) and generate the View code. Not the runtime you desired but very flexible.

You could look at the Dynamic file driver and see if it offers anything with Dynamic VIEWs. I don’t see how to get the Doc PDF from the SV website. You could create a Dynamic File that points to an SQL View?

There were quite good competitive offerings available that time. You might know xLib and/or DynaLib, both created by talented Russian programmers. And I was not going to grab their market share. I just needed this functionality without black box dependencies.

By the way, (un)fortunately, those products became abandoned and aren’t supported nowadays. xLib evolved to Dynamic Driver while the author was working for SV. DynaLib last updated for Clarion 7 and doesn’t support later Clarion versions. I am afraid, the caveat is that there isn’t enough demand from Clarion community. Anyway, I can consider to take over this niche.

It says here Alexey wrote it
Clarion, Dynamic Data (computer-programming-forum.com)

Forget DynaLib, get XLib. It’s exactly what you want and the guy that wrote
this is very helpful and will point you in the right direction as to what
you want to acheive.
His name is Alexey Solovjev.

All I know of Alexey is he wrote the compiler after hacking it and fixing some bugs in it so Topspeed offered him a job, and my dealings with him on the ngs has been getting a filter to work using Somevar = 0*1 the point being it needed the mathematical function to get the filter to interpret it properly.

It seems xLib is still online and can be found here.
Software for Clarion (archive.org)

The source code can be downloaded here.
Wayback Machine (archive.org)

Edit.

Found more info on it here
Clarion, Change File Driver at Runtime (computer-programming-forum.com)

You can find two ZIPs (XLIBTEST.ZIP and XLIBINFO.ZIP) with example programs
and library’s INC and description files on my ftp:
Site: ftp://ftp.cl.spb.ru
Login: also
Password: SSS
Files are in the XLIB directory. Let me know if you have problems with ftp
access.
Tests:
DTEST demonstrates declaration of QUEUEs and FILEs at run time. It lists
all files from the selected directory in the listbox based on the queue
declared at run time and then writes information about tagged files into
the TPS file declared on the fly too. As easy to see, there is no any
difference between “normal” and “hand-made” queues behavior.
T4 declares a FILE with the same structure as statically declared QUEUE
has plus extra two fields and copies data from the QUEUE to the FILE.
T6 creates the “normal” FILE and fills it with some data. Then it clones
the FILE to “run-time” file and copies records from one file to another.
T8 demonstrates how XLIB works with GROUPs and arrays including nested
dimensional GROUPs. NB that ANY variables not allow you access particular
array item or particular GROUP field if they reference such objects.
I have an extension for XLIB that allows to create/modify VIEWs at run
time but it has been written after my joining TopSpeed and I have no
permission to supply it together with XLIB.
Feel free to ask more information about XLIB.
Alexey Solovjev

This might also be a clue as to how Alexey got it to work, statically linked drivers.

from the xLibInfo.zip, Local.txt file.

Therefore, drivers used
in the project compiled in Local mode should be registered statically to be
available for XLIB library.

In theory if its possible to create the structure at runtime, its got an address so getting that address linked to other parts of the code should make it work. :crazy_face:

Actually, the site is not online but available through time machine, and include files aren’t the source code. Thanks anyway.

Online in the sense a copy can be found online, but yeah I couldnt find the clw, and I searched through the wayback machine to find the demo app zip file but strangely the wayback machine doesnt have it, its got the Clarion dll.s otherwise it would have been a case of load the demo app into Ghidra (ghidra-sre.org) and see what its doing.

Saying that though I’m sure it could be figured out, does yours use the same methods or do you do it differently?

.

My classes and procedure prototypes are different. But overall approach is the same.

This is an interesting topic.

Sometime ago I found a chart comparison of xLib/xView, DFD and Dynalib. It was a matrix with the three tools on the columns and differents aspects on the rows, and + and - symbols on the cells. It was very interesting but I can’t find it now. Anyone remember that one?

With that table of characteristics in mind it would be interesting to describe your solution.

Also last year there was this post from Stev Ryan Dynamic Data structures in Clarion using DynaLib
mentioning they were working on it, I wonder of the current status of the project.

I don’t have that xLib/xView, DFD and DynaLib comparison matrix near at hand. But I can say for certain, my classes are having all the + symbols on the cells.

Of course, I’ve seen this post more than a year ago. And there is a fresh answer from the topic starter:

As you can see, Stev has DynaLib license (with source code) purchased officially. He can make any change in the code for in home use. But in accordance to license agreement, he doesn’t have the right to share nor distribute any part of the product purchased, even though the product is not supported by the vendor any more.

Product maintenance requires specific knowledge and substantial changes to support the later Clarion 8, Clarion 9(.1), Clarion 10, Clarion 11(.1) versions. So, Stev decided to remove the need to use DynaLib in his project.

1 Like

Yes, it wasn’t clear to me if Stev was working on a product that used dynamic structures but also on updating/improving the dynamic library for internal use and/or for offering as a product. I was afraid of the licesing issues too but there was the possibility he had an special one. Although the last post you mentioned seems stating it were more for internal use and even not using now at all.

I found the mentioned table:
http://web.archive.org/web/20070328033603/http://www.nikasoft.co.uk/index.php?page=products&hid=2#com

I know you may not already decided about your offering, but could you reconfirm having those characteristics? Is there something extra that worth mentioning?

Thanks.

Hi yes we have the source code for DLIB and can if we wish (and have placed a wrapper around it.)

That wrapper can in fact be legally made available for developers to use.

We just dont have the right to sell DLIB or the source but we can create a Product using DLIB.

Since the source is no longer supported we consider for all practical terms the authors wont mind us modifying the code and using it in products.

Currently im waiting on the script author to test the runtime bindable CPP code and then we can move forward to showing off some examples of runtime database access combined with a recompiled and renamed DLIB.

You wont know your using DLIB and really its time the product got some use by people. If the russian sue us im sure we can come to an arrangement if the banking system still works!!!

“DynaLib last updated for Clarion 7”

please note we will be compiling and testing DLIB source code this weekend for clarion 11.

While we wont be using DLIB directly in projects we have a bindable wrapper coming for it.

The bindable examples have been completed to show how this works for scripts.

DLIB is a complex source code library that does not lend itself to busy developers tinkering.

It also uses memory addresses of clarion runtime data structures.

And that is why we are moving to replace it with perhaps MY SQL bindable runtime structures for data for script applications.

While that wont be as fast as a Clarion Queue for instance it at least means the data structure is supported by more than one company.

Does it work with ASLR switched on?
Edit.

Mitigate threats by using Windows 10 security features (Windows 10) - Windows security | Microsoft Docs

Address Space Layout Randomization in Windows Vista | Microsoft Docs

When “ASLR” Is Not Really ASLR - The Case of Incorrect Assumptions and Bad Defaults (cmu.edu)

dumpbin /headers appname.exe
Relocations stripped = can not be randomised by ASLR despite having /DYNAMIC_BASE

To install Dumpbin (part of MSVC build Tools and Visual Studio)
Additional MSVC Build Tools | Microsoft Docs
Download Microsoft Build Tools 2015 from Official Microsoft Download Center

To locate Dumpbin
Releases · microsoft/vswhere · GitHub
vswhere -latest -find **/dumpbin.exe

The folder Dumpbin is located in, will need to be in the system path which can be added manually using
rundll32.exe Shell32.dll,Control_RunDLL sysdm.cpl
Advanced Tab, click the Environment Button, select System Variables > Path and add to the end of the line: Where ever its located:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX86\x86
C:\Program Files\Microsoft Visual Studio 8\VC\bin
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\Hostx64\x64

Use the Microsoft C++ toolset from the command line | Microsoft Docs
c# - Cannot find Dumpbin.exe - Stack Overflow

Open File Explorer, navigate to folder with the exe/dll you want to test, type CMD in the address bar (where it shows This PC > Folder > Folder > Folder), dos window opens then type

dumpbin /headers appname.exe

In Win10 Exploit Protection, I found out that Control Flow Guard, only works if compiled with the CFG attribute and AFAIK C11 doesnt support that (?yet?).
/guard (Enable Control Flow Guard) | Microsoft Docs
Control Flow Guard - Win32 apps | Microsoft Docs

Now there is a sandbox called Application Guard built into windows but MS also admit if the sandbox container is compromised, its still game on for the attackers, but it can be used to make an app like a Kiosk app to the point where it wipes all data files on program shutdown but I dont know if this would extend to wiping records from a data source like MS SQL server.

Important: Be aware that enabling this setting with potentially compromised graphics devices or drivers might pose a risk to the host device.
Important: Be aware that enabling this policy with a potentially compromised container could bypass camera and microphone permissions and access the camera and microphone without the user’s knowledge.

Application Guard pages in MS Edge
edge://policy/
edge://application-guard-internals/#status

Windows 10 - All Things About Application Guard - Microsoft Tech Community

Configure the Group Policy settings for Microsoft Defender Application Guard (Windows) - Windows security | Microsoft Docs

But the point being, ASLR is supposed to have stopped being able to read Runtime data structures and how does it know your code/?dll? is supposed to work with the Clarion runtime, hence the question. :grinning:

a bit of history…

Aleksey Timkov (from Ukraine) owned NikaSoft and sold (among other things) DynaLib which was written by Oleg A. Rudenko (from Russia).

At some stage around 2008 Aleksey changed his business name to UA Developer but still sold DynaLib for a while. eg. Wayback machine has captures from 2010:

https://web.archive.org/web/20101214082247/http://uadeveloper.com/clarion/dynalib-library/

A couple of years back I tried unsuccessfully to purchase the source from Oleg. I made contact and at the time the price was (USD)

Advanced build - $300
Professional build - $400

The cheaper advanced version does not have the tDynaView class.

No “black box” - all source code in .clw, .inc and .equ files.

Last version - v5.0.4.6 - C50b / C55h / C63.9053-9059 / C72.7283 / C73.7995 / C80.9759

Oleg mentioned that he tried this version under the first versions of Clarion 9.0 and it worked.

Oleg sent me his bank details but I never managed to transfer using either transferwise.com or PayPal. I can only assume it would be even harder (perhaps impossible) to send money to Russia now due to the war restrictions.

this is the approach taken by QView debugging tool for queues which uses DynaLib. See:

http://www.sdksoftware.uk/index.htm

The new project just created it first runtime queue from a simple string declaration.

Due to scope issues if a queue is returned the clarion runtime lost scope for some functions like Who and Where.

Creating a proxy queue container and passing it to the queue class constructor code returned a valid queue that the runtime could access IN SCOPE.

The queue constructor could be access with the following code and has passed it first test.

include(‘DdynaDataStructs.inc’),ONCE
include(‘qclasscontainer.inc’),ONCE

MAP

   module('ddynartl.clw')
      CreateQueuestruct(string DataStructure,qproxycontainer q),long 
  END
    
END

qproxy &qproxycontainer

Qflds ANY
qaddress long

CODE
Qflds = ‘Stockprices QUEUE,PRE(TST);’ |
‘Name STRING(@S100),ALIGN©,Name(’‘Name’’);’ |
‘Code SHORT(@N_5),ALIGN®;’ |
‘Price DECIMAL(@N13`2),ALIGN®;’ |
‘Input DATE(@D6.B),ALIGN®;’ |
‘Closed DATE(@D6.B),ALIGN®;’ |
‘END;’

qproxy  &=  new(qproxycontainer)    
qaddress = CreateQueuestruct(Qflds,qproxy)
if qaddress > FALSE
     
       Qflds  &= what(qproxy.Q,1)
      Qflds = 'Your Name'
      add(qproxy.q)
      message(Qflds&'   '&who(qproxy.Q,1)&' '&who(qproxy.Q,2))
     
END

Not another climate change denier! :rofl: