PxPlus User Forum

Twitter Twitter Twitter

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Mike King

Pages: 1 ... 61 62 [63] 64 65
931
Programming / Re: Strange behaviour reading ctl value
« on: August 03, 2018, 09:29:39 AM »
It sounds like the Multi line input has Signal on exit set, however I just ran this on my system here using PxPlus 2018 to a Suse Linux server and it only returned '1'.

What versions (host and WindX) are you running?


932
Wish List / Re: Select a single field not Just *
« on: August 02, 2018, 01:39:47 PM »
Harry, while I have in the past advised people of ways to accomplish this, I suspect many felt it too complex so I decided that I'd post a solution myself.

Basically my solution is to create a unique file/table reference based on the columns you want to select so that the data being returned only consisted of the fields you wanted. 

There is a fairly easy way to accomplish this using some of the build-in functionality within PxPlus.

The Scenario:

Lets assume you want to have you application be able to run with native files or SQL tables interchangeably and you have a file called "PRODUCTS" which has a variety of columns including a primary key of the PRODCD$, a NAME$ column and a PRICE column.  In order for most of your code to be compatible  when running on a SQL based table, you have a PREFIX FILE which defines type of database, database name, table name, etc. so that in your code you only ever have to issue an OPEN to "PRODUCTS"

Now you want to create a PxPlus SELECT that will work on either type of file but to improve database access speed you only want the system to pull the PRODCD$, NAME$, and PRICE columns down from the server.

The Solution:

To make this simple to use from your code, create a dummy system library link file called *fields* which points to temporary memory file but invokes a device driver (*dev/fields) to actually return the data you want.

So here is the device driver which you need to save in *dev/fields:

Code: [Select]
! Field Field filter driver *dev/fields
 !
  file_chn=lfo
  read data from fin(lfo,"FILENAME"),sep=";" to *,filename$,fields$,keyno
  if filename$="" \
   then end
 !
  close (lfo)
 !
  open input (file_chn,iol=*)filename$
 !
  file_type$=mid(fib(file_chn),19,1)
  if file_type$="2" or file_type$="K" \
   then goto Keyed_file
 !
  if pos(file_type$="OoQa")=0 \
   then msgbox "File "+filename$+" not a valid type for Filter";
        close (lfo);
        exit 10
 !
 ! Database file
 !
  p$=stp(pth(lfo),1,";")+";**;"+stp(opt(lfo),1,";")+";"
  close (lfo)
 !
  nopts=pos(";"=p$,1,0)
  dim o$[1:nopts]
  read data from p$,sep=";" to o${all}
 !
  path$=""
  opt$=""
 !
  for opt=1 to nopts
  o1$=stp(lcs(o$[opt]),2) ! Strip leading/trailing spaces and make lcs
  if o1$="**" \
   then path$=mid(opt$,2);
        opt$="";
        continue
 !
  if mid(o1$,1,4)="rec=" \
   then continue ! Throw away original rec= if present
 !
  if mid(o1$,1,4)="key=" \
   then msgbox "key ... '"+o1$+"'";
        if (keyno--)<>0 \
         then continue
 !
  opt$+=";"+o$[opt]
  next
 !
  opt$+=";rec="+sub(fields$,"$","")
 !
  open input (lfo,iol=*,opt=opt$(2))path$
  end
 !
 Keyed_file:
  setdev (lfo) program pgn
  setdev (lfo)iol=cpl("IOLIST "+fields$)
 !
  if keyno<>0 \
   then extract (lfo,key="",kno=keyno,dom=*next)* ! Position file
  end
 !
 Post_read:
  local _ACCESS_MODE,_KEY$,_INDEX,_VALUE$,_FLAG,_KNO
  enter _ACCESS_MODE,_KEY$,_INDEX,_VALUE$,_FLAG,_KNO
 !
  local iol=iol(lfa:*) ! Preserver all values
  read data from _value$ to iol=iol(lfa:*)
  return rec(iol(lfa))

Now can run "*UCL" to define the link file in the system library called *fields* which points to *memory* as a file with the device driver above.

'Link' files utility
Name of 'Link' file?*fields*

File '*fields*' does not exist. Create?
Yes No Quit

'*fields*' links to...
Name of file/device:*memory*

What type of link is '*fields*'
File Printer Device Quit

--- Select the driver fields from the list provided ---

Okay now you can use the logical file name "*fields*;filename;field1$,field2$,...; keyno" in an OPEN or SELECT statement and get just the fields you specify.

Where:

  • filename
    Is the name of the file or database table defined in your prefix file
  • field1$, field2$
    Is a list of the fields you want returned
  • keyno
    Is the optional key number you want to use.  For Database files the fields used in the key MUST be set in the list of fields being selected.

So for the example mentioned above your select would be:

SELECT * FROM "*fields*;PRODUCTS;PRODCD$,NAME$,PRICE;0"
...
NEXT RECORD


Hope this gives you some ideas as to how to accomplish what you wanted.

BTW: If you use something like this just make sure you copy/create the *fields* link file and device driver to your systems library whenever getting new software releases.




933
Wish List / Re: Select a single field not Just *
« on: August 01, 2018, 04:12:23 PM »
Another option if you are using an external database would be to specify a pathname with just the columns you want.  For example:

OPEN (n) "[odb]Database;Table;key=keyfield1,keyfield2;rec=field1,field5,field7"

This would ONLY return you the columns specified in the REC= clause.  The SQL  SELECT, INSERT and UPDATE commands generated by the system would only include the field names you supplied and the PxPlus SELECT directive can continue to contain the * for all the fields as it will apply to only those in the REC= clause.

You could accomplish this a couple of ways, especially if you are using a PREFIX file.  Simply pre-create logical file names in the prefix file that have the path/option specifications you need and then open these logical files.

Alternatively you could dynamically create entries in the prefix file and create a small object with you could pass the desired field names to.  It could generate the prefix file entries as needed and return a logical file name to use for the OPEN/SELECT -- maybe something like to original filename plus the SHA-1 (HSH function mode -1) of the field names.

This would be fairly easy to implement and get you what you want with minimal effort while maintained code compatibility with non-External database implementations.

934
Programming / Re: Create Chart on excel sheet
« on: July 31, 2018, 09:39:58 AM »
Documentation on the Excel macros using DDE is no longer easily available from Microsoft.  You can find the original documentation on Excel DDE from Microsoft in a .HLP file call "MACROFUN.HLP" however, ever since Vista, Windows no longer supports this file format so the file is not of much use on newer systems.

Instead Microsoft recommends you use the COM/OLE interfaces for Excel.  You can find a lot of documentation on the methods and properties associated with this interface online.

PxPlus (like EXCEL) still supports both, DDE for older applications and COM/OLE for newer applications.

935
Nomads / Re: Button Don't underline &
« on: July 31, 2018, 09:10:10 AM »
Okay -- its in the property sheets setup and not on the main display of properties, on the secondary panel which is why I missed it.

This option doesn't exist for buttons, but the panel to select fonts is when using property sheets is generic and not all options apply to all controls.  We generally use Nomads+ or the revamped Folder style for panel design as it provides more information, each folder set is specifically designed based on the type of control, and in our opinion it is easier to work with.

By default the & always is replaced by an underscore of the following character and there is no way to disable this behaviour.

936
Nomads / Re: Button Don't underline &
« on: July 30, 2018, 04:48:44 PM »
Where are you seeing this option and what version of PxPlus are you using?

I have checked back to version 9 and not seen the option "underline & characters" for buttons.  It exists for Fonted text but not for buttons.

937
iNomads / Re: Passing in a variable to a iNomads transaction
« on: July 30, 2018, 11:16:46 AM »
One quick note, on reviewing your original post you have the URL wrong.  In your post you asked about

http://bobtest.asifocus.com/?txid=testOrderMnt.pvx?arg_1=MD?arg_2=2018072412345rcO

A question mark (?) separates the site URL and its parameter list which is referred to as the query_string
For iNomads subsequent parameters should be separated by the ampersand (&) character. 
This is standard for most web sites.  (ref https://en.wikipedia.org/wiki/Query_string)

So your URL to work under iNomads would need to be:

http://bobtest.asifocus.com/?txid=testOrderMnt.pvx&arg_1=MD&arg_2=2018072412345rcO

938
iNomads / Re: Passing in a variable to a iNomads transaction
« on: July 27, 2018, 04:46:46 PM »
No problem, the %inomads object includes properties/methods that can be used to access the argument list that was included with the original URL.

These include:

  • %inomads'Url_Arg$(argno)
    Returns the URL argument/parameter indicated by argno. If no parameter is present at the specified argno, an Error #42 will be generated.
  • %inomads'Url_Arg$(name$)
    Returns the value assigned to the specified URL parameter or "" if not set.
  • %inomads'Url_Arg_Cnt
    Number of parameters found on the URL line.

So for your example you could set ARG_1$=%inomads'Url_Arg$("arg_1").

More information about inomads properties and methods can be found at this link

939
Programming / Re: How to use the line below the help menu?
« on: July 27, 2018, 11:57:32 AM »
That area is the Toolbar line and you can but controls there by specifying a line number of -1.

For Example:

  • multi_line 10,@(0,-1,10,1)
  • button 11,@(10,-1,2,1)="{!Bug}",opt="W"[/tt]

The controls, unless defined as GLOBAL will be considered part of the current window even though they appear in the toolbar.  This means they will be deleted when the current window is closed.

Note: that the columns widths assume the toolbar is 80 columns wide unless you set the 'TB' system parameter in which case the toolbar columns/widths will match that of the window layouts.

940
Nomads / Re: Locked Cells in a Grid
« on: July 25, 2018, 04:04:37 PM »
No -- its just that the 'SkipLockedCells only applies to tabbing or movement by the arrow keys.  By default the system forces focus to the first cell in a grid.  If you want to start in a different column try setting CurrentColno in the presets to the column you want to start in.

NOTE: If the program sets the current cell to a locked cell or the user clicks on a locked cell, the system will still go there.  The 'SkipLockedCells property only applies to keyboard movement.


941
Language / Re: Update a LIST_BOX
« on: July 25, 2018, 01:21:41 PM »
Actually its easier than that -- just set 'Item to the index for the item you want to change then set 'ItemText$ to the new value.

If you want to change the current item the set 'Item to 'CurrentItem and then change 'ItemText$. Here is a demo program.
Code: [Select]
0010 PRINT 'CS'; LIST
0020 LET Lb=100
0030 LIST_BOX Lb,@(40,1,12,6),FNT="*"
0040 LIST_BOX LOAD Lb,"Dog/Cat/Pig/Cow/Ant/Gnu/"
0050 WHILE 1
0060 SET_FOCUS Lb
0070 INPUT *
0080 IF CTL=4 THEN BREAK
0090 LET item=lb'currentItem
0100 IF item=0 OR CTL<1 OR CTL>3 THEN CONTINUE
0110 IF CTL=1 THEN LET Lb'item=item; LET Lb'ItemText$=UCS(Lb'ItemText$)
0120 IF CTL=2 THEN LET Lb'item=item; LET Lb'ItemText$=LCS(Lb'ItemText$)
0130 IF CTL=3 THEN LET Lb'item=item; LET Lb'ItemText$=CVS(Lb'ItemText$,256)
0140 WEND
0150 ! list_box remove Lb
0160 END
Run it and select an item from the list.  Pressing F1 will convert to upper, F2 lower, F3 mixed, F4 Quit


942
Off Topic / Re: Mailing List Update
« on: July 25, 2018, 10:21:55 AM »
The problem is that the mailing list is actually maintained in the original format that the emails were received in.  This poses a number of problems in addition to the obvious issue of how to identify people's names within the email.

  • The text portions vary from plan text, quoted printable, base64 encoded, UTF8, and HTML.
  • Emails may contain images which may include personal information.
In addition the email headers would need to be striped as they include personal tracking info such as IP addresses.

Even if we could somehow extract the mails and pull out/mask the identifying information, most Personal Data rules require us to allow user to be provided copies of, edit or delete the contents of any email they posted and a list of who the email was sent to. 

As we have mentioned, we are adding entries to the FAQ and Tech Tips sections of this forum as the issues come up.
There is also the issue that many of the old responses are just out of date and contain information that is no longer relevant on the newer PxPlus versions and including these cold potentially just confuse people.

943
Programming / Re: File maintenance panel creation for flat files,
« on: July 24, 2018, 08:50:49 AM »
Not certain what you mean by 'Flat' files -- are you referring to Serial/text files?  If so the file maintenance system is designed to work with keyed files and not serial files.

If you do mean keyed files, then you should be able to set the global variable before running the file maintenance generator.  Once the pane/program is generated it will use whatever is in your global variables.

944
Wish List / Re: Forum Notifications
« on: July 20, 2018, 04:29:00 PM »
We decided it was better to split on major components since we have some clients that don't use iNomads, some don't use Nomads, etc...

We tried to keep the number of categories to a manageable level.  Having some basic sections allows users to only monitor those sections that may impact them.  Plus some boards such as "Off Topic" or "Wish List" are more suited to casual inquiry as opposed to sending email notifications.

About the only area where it might make some sense to merge sections would be "FAQ" and "Tips and Techniques"; but here too we felt the breakdown was better:

  • FAQ for problems and issues people may be having or have reported.
  • Tips and Techniques for ways you can improve your application you may not be aware of.
While similar they do serve different purposes.

945
Wish List / Re: Forum Notifications
« on: July 20, 2018, 03:57:44 PM »
Thanks for the suggestion.  We just enabled notification for the FAQ and Tech Tips so you should be good to go now.

Pages: 1 ... 61 62 [63] 64 65