Re: Locate a Record Problem (Nearly Solved)

sherman levine


In this range expression, one of the first two conditions is always true, so you never get beyond them
If(pAircraft Reg= ' ', Aircraft Reg = Aircraft Reg, If(pAircraft Reg <> ' ' ,pAircraft Reg = Aircraft Reg, 

I think you're looking for something like this as a range expression
(pA='' or pA=A) and (pB='' or pB=B) and (pC='' or pC=C) etc

Now, particularly if you're working with a SQL database, the better way to accomplish the same thing in Magic is the cndrange() expression

For variable A,  range is  cndrange(pA>'',pA) to cndrange(pA>'',pA)
For variable B,  range is cndrange(pB>'',pB) to cndrange(pB>'',pB)


On 9/2/2019 7:45 PM, buster reinke via Groups.Io wrote:
I've found a way around the problem, but it only works for programs with 1 parameter passed on. I removed the Expressions in the From and To fields, and put an expression in the Tasks/Range/Locate Range Expression area instead.
I simply used If(pPart Number=' ',Part Number = Part Number, pPart Number = Part Number) This now allows Locating in Tables with or without parameters passed to them.
But I have some programs with multiple parameters passed to them and it is only recognising the first part of the expression. I used the following expression:
If(pAircraft Reg= ' ', Aircraft Reg = Aircraft Reg, If(pAircraft Reg <> ' ' ,pAircraft Reg = Aircraft Reg, If(pPart Number = ' ' ,Part Number = Part Number, if(pPart Number <> pPart Number = Part Number, If(pSerial Number = ' ' ,Serial Number = Serial Number, if(pSerial Number <> pSerial Number = Serial Number,0))))))

Now the Locate function works, but the passed parameters are being ignored except for the Aircraft Reg part. (This was initially at the end of the expression, and when it didn't work, I moved it to the start of the expression, and it then worked, eg, initially I was getting all Aircraft in the data view, and when I changed the expression, I was able to filter it to the aircraft I want, but for the Part Number ans Serial Number part of the expression, I am still getting everything in the data view. Not all of the parameters are being used all the time, some of them are skipped in the arguments section.

I'm sure that it doesn't like my expression format, but I'm not sure how to fix it. If anyone there can understand what I am trying to do here, I would appreciate help that with an expression that will allow all the passed parameters to be filtered as necessary.
On Tuesday, 3 September 2019, 7:21:21 am AEST, buster reinke via Groups.Io <buster_png@...> wrote:

Further to this, it wasn't my expression causing this. It appears that if any of the files are using passed parameters to it, the locate to function will not work unless the * is placed after the ficure entered into the locte field. Maybe it is a bug after all.....This explains why some of my tables will locate properly, and some wont.....


On Tuesday, 3 September 2019, 7:14:23 am AEST, buster reinke via Groups.Io <buster_png@...> wrote:

Hi Govert, I've worked out what's causing it, I just now need to find a solution. I have been trying to use the same program files whether they are accessed directly, or if they are using papameters passed to them:

So in the range from field, I have used the expression "IF(pPart Number=' ','0',pPart Number"

In the range to field, I have used "IF(pPart Number=' ','ZZZZZZZZZZZZZZZZZZZZZZZZZ',pPart Number".

This allowed me to get the table to ignore the Parameters if I accessed the table directly, but this is what is interfering with the Locate a Record function.

I could just create several files, some with the required parameters, and some without, and link them to the programs that call them, but that means I can't just make any programming changes in the one place if required.

Do you know another way I can use the same file, whether passed parameters are used or not?

On Tuesday, 3 September 2019, 6:53:33 am AEST, buster reinke via Groups.Io <buster_png@...> wrote:

Hi Govert, they are Alpha fields I am trying to locate on. They are all Key Indexes, but I just tried using the * after entering the first digit, and that worked.


On Monday, 2 September 2019, 8:59:03 pm AEST, Govert Schipper <govertschipper@...> wrote:


Is the field you are locating on an Alpha field? If it is Numeric, you will have to type the whole value
Is the field you are locating on the first or only key segment? If not, you might try to use an * right after your value


Van: <> namens buster reinke via Groups.Io <buster_png@...>
Verzonden: maandag 2 september 2019 12:31
Aan: <>
Onderwerp: Re: [magicu-l] Locate a Record Problem
Hi Keith, yes, I have Indexes on the Fields I am trying to search on. They are Alpha Fields. I have just found that if I type in the entire contents of a field eg "2622311-16", it will take me to the record, but if I just type 26 and hit locate, it takes me back to the start. It has me buggered, other Line Tables are working perfectly.


On Monday, 2 September 2019, 8:11:00 pm AEST, Keith Canniff <kcanniff@...> wrote:



  1. Do you have an index on the field you’re searching on?
  2. Is the field you’re searching on alpha or numeric? If numeric it’s going to field the lowest number, usually going to the first (or near first record), especially if it can’t find the value because it’s looking for the first record >= what you typed in.  




From: <>On Behalf Of buster reinke via Groups.Io
Sent: Monday, September 2, 2019 5:54 AM
Subject: [magicu-l] Locate a Record Problem


Hello all, I am having a problem with the Locate a Record function for some Tables. Some Line Tables work with no problems. It always takes me to the first record when I enter the first digit, but for other tables, it always takes me back to the 1st record. Some of my Screen tables will Locate a Record providing I am only trying to Locate on the first field. I can't see any differences in the Line Tables that the Locate a Record work on, but I know I must have missed something. Does anyone have any idea what could be causing only some Line Tables to Locate correctly on all fields, and none of the Screen Tables to work correctly?



Join to automatically receive all group messages.