Date   

Re: "Included Columns" in index definition? (MSSQL)

Andy Jerison
 

Why are you defining an index? 


On Sun, Dec 20, 2020, 12:46 Avgerinos <mento@...> wrote:
Hi magicians :-)

When defining an Index In the Data-Repository of XPA (v.3 or 4) and
besides the "Index Key Columns",
is there any way to specify the "Included Columns" when defining an
index for an MSSQL table?

Thanks in advance
Avgerinos






"Included Columns" in index definition? (MSSQL)

Avgerinos
 

Hi magicians :-)

When defining an Index In the Data-Repository of XPA (v.3 or 4) and besides the "Index Key Columns",
is there any way to specify the "Included Columns" when defining an index for an MSSQL table?

Thanks in advance
Avgerinos


Re: Capture Field Value with Function Key

Wes Hein
 

You can also use VarPic to format it correctly.  LastClicked or Lastpark might give you the variable

Wes


Re: Capture Field Value with Function Key

sherman levine
 

Mike,

This worked in 9.4

Create a new task - online for the moment, with two parameters
    Number (N8.3) ??
    Alpha 1

In the main program,
    Hotkey - Call program (new task) with parameters editget() and varattr (THIS())  [Those are both expressions in the main program. I couldn't get editget() to evaluate in the called program when called from the main]

Varattr will be N if you triggered from a numeric field.

I assume you're planning to do the math in the online task (using EVAL perhaps) and return the result to the parent.

The challenge will be getting the data back. I suspect you'll need to clear the entry field and then kbput the calculated result as a string
something like kbput ('Ctrl+Home'KBD&'12345.678')    in task suffix

Sherm


On 12/18/2020 4:00 PM, Mike McMillin wrote:

I should also tell you why I am doing this.  In older Magic versions you could do one function math in a numeric field.  In 3.3 that no longer works so I was trying to do something to emulate it with out having to go to the hundreds of numeric fields in my application.



Re: Capture Field Value with Function Key

Todd Baremore
 

Mike,

Try VarAttr(VarInp()) to determine the field data type.
Todd
On 12/18/2020 3:57 PM, Mike McMillin wrote:

The issue I have is I don't know if the EditGet() function is getting a numeric or an alpha field.  If it is an alpha and I am initializing a numeric field with EditGet() I get a strange number.  I only want to get numeric fields.  I can't seem to figure out a way to tell what the attribute is from the field that EditGet() is getting.

Mike McMillin


Re: Capture Field Value with Function Key

Mike McMillin
 

I should also tell you why I am doing this.  In older Magic versions you could do one function math in a numeric field.  In 3.3 that no longer works so I was trying to do something to emulate it with out having to go to the hundreds of numeric fields in my application.


Re: Capture Field Value with Function Key

Mike McMillin
 

The issue I have is I don't know if the EditGet() function is getting a numeric or an alpha field.  If it is an alpha and I am initializing a numeric field with EditGet() I get a strange number.  I only want to get numeric fields.  I can't seem to figure out a way to tell what the attribute is from the field that EditGet() is getting.

Mike McMillin


Re: Capture Field Value with Function Key

Steven Blank
 

Mike,

Easy-peasy.

Create a System Event Handler in the Main program that is triggered by F6. Simply evaluating the EditGet() function within this handler will return the current value of the control on which the user is parked when they pressed F6, even if the underlying variable to which the form control is bound has not yet been updated, i.e. the user has typed something but has not yet moved off the control.

HTH.

Steven G. Blank
SGBlank Consulting.


On 12/18/2020 9:24 AM, Mike McMillin wrote:

I would like to create a Function in the Main Program the is initiated by pressing the F6 key.  This function would capture the contents of the field that the cursor was on when F6 is pressed.  Is this possible with out going to every field and adding some logic to update the Main Virtual?

Mike McMillin 


Re: Capture Field Value with Function Key

Mike McMillin
 

Thank You Frederik,

You have are the best, I really appreciate the ideas and I am now sure I can get my function to work.

Mike McMillin


Re: Capture Field Value with Function Key

Frederik Soete
 

Three options come to mind quickly:

- Via a DotNet snippet you can try to read the parked on control.

- Via EditGet() you can get edit field contents.

- Via VarInp(x) you can get the parked on variable, then use VarCurr(y) to get its contents or VarAttr(y) to get its type.

HTH,

Frederik Soete

Op vr 18 dec. 2020 18:24 schreef Mike McMillin <mike.mcmillin@...>:

I would like to create a Function in the Main Program the is initiated by pressing the F6 key.  This function would capture the contents of the field that the cursor was on when F6 is pressed.  Is this possible with out going to every field and adding some logic to update the Main Virtual?

Mike McMillin 


Capture Field Value with Function Key

Mike McMillin
 

I would like to create a Function in the Main Program the is initiated by pressing the F6 key.  This function would capture the contents of the field that the cursor was on when F6 is pressed.  Is this possible with out going to every field and adding some logic to update the Main Virtual?

Mike McMillin 


Re: DirectSQL removing the ORDER BY clause

Joseph Feldman
 

I tried it on Magic 3.3d and the order by clause is not removed, and is working fine

Joseph

On Thu, Dec 17, 2020 at 2:22 PM Avgerinos <mento@...> wrote:
Hi magicians

In XPA 3.3c, I have a simple online task that uses a Direct SQL command to select the TOP-10 records from a table:
SELECT TOP 10  [product], [price], [volume], [value]    FROM [dbo].[orders]    WHERE [product] = 'TEST'   ORDER BY [volume] DESC

When I run the program I get a different result set compared to what I 'm getting when I run the query in the Management Studio (MSSQL 2014).
By checking via the SQL profiler, I found out that Magic is removing the ORDER BY clause when executing the command.

Anyone experienced something similar? Any way to avoid?

Best regards
Avgerinos


Re: DirectSQL removing the ORDER BY clause

Mike Bannon
 

Hi Avgerinos

 

How about creating a View:

SELECT TOP (10)  ……

ORDER BY …..

 

Then use that instead of direct SQL?

 

HTH

 

Mike Bannon

 

DFLogo1

 

From: main@magicu-l.groups.io [mailto:main@magicu-l.groups.io] On Behalf Of Avgerinos
Sent: 18 December 2020 08:33
To: main@magicu-l.groups.io
Subject: Re: [magicu-l] DirectSQL removing the ORDER BY clause

 

Hi again and thanks for all your suggestions

Tried all of the proposed solutions, but none of them worked.
I also tried a older suggestion that used to work in older versions (by wrapping the SQL statement in a EXEC command)
I also managed to ...crash the Runtime engine, by using a DIRECT SQL in the form "WITH cte AS (SELECT TOP ...) SELECT <columns> FROM CTE"

I will keep on looking for an answer, out of academic curiosity ;-)

Best Regards
Avgerinos

On 17/12/2020 9:21 μ.μ., Avgerinos wrote:

Hi magicians

In XPA 3.3c, I have a simple online task that uses a Direct SQL command to select the TOP-10 records from a table:
SELECT TOP 10  [product], [price], [volume], [value]    FROM [dbo].[orders]    WHERE [product] = 'TEST'   ORDER BY [volume] DESC

When I run the program I get a different result set compared to what I 'm getting when I run the query in the Management Studio (MSSQL 2014).
By checking via the SQL profiler, I found out that Magic is removing the ORDER BY clause when executing the command.

Anyone experienced something similar? Any way to avoid?

Best regards
Avgerinos

 


Virus-free. www.avast.com


Re: DirectSQL removing the ORDER BY clause

Avgerinos
 

Hi again and thanks for all your suggestions

Tried all of the proposed solutions, but none of them worked.
I also tried a older suggestion that used to work in older versions (by wrapping the SQL statement in a EXEC command)
I also managed to ...crash the Runtime engine, by using a DIRECT SQL in the form "WITH cte AS (SELECT TOP ...) SELECT <columns> FROM CTE"

I will keep on looking for an answer, out of academic curiosity ;-)

Best Regards
Avgerinos

On 17/12/2020 9:21 μ.μ., Avgerinos wrote:

Hi magicians

In XPA 3.3c, I have a simple online task that uses a Direct SQL command to select the TOP-10 records from a table:
SELECT TOP 10  [product], [price], [volume], [value]    FROM [dbo].[orders]    WHERE [product] = 'TEST'   ORDER BY [volume] DESC

When I run the program I get a different result set compared to what I 'm getting when I run the query in the Management Studio (MSSQL 2014).
By checking via the SQL profiler, I found out that Magic is removing the ORDER BY clause when executing the command.

Anyone experienced something similar? Any way to avoid?

Best regards
Avgerinos



Re: DirectSQL removing the ORDER BY clause

Tim Downie
 

some times this order of the result set depends on the result database set in the ctrl S screen.

Stay away from having the result in and SQL database and try making this memory.

All magic is doing is running the select and dumping the result in a temp table that looks like your output params  - this table cab be seen in the dbms and is removed (as long as you exit properly)
when task closes

The data will be read from the db in the order you ask but then your presented the temp result.




From: main@magicu-l.groups.io <main@magicu-l.groups.io> on behalf of Lado Wali <ladowali@...>
Sent: Thursday, 17 December 2020 11:24 PM
To: main@magicu-l.groups.io <main@magicu-l.groups.io>
Subject: Re: [magicu-l] DirectSQL removing the ORDER BY clause
 
I would instead try writing the store procedure. I know this would be a very small one line stored procedure but should work.



On Thu, Dec 17, 2020 at 6:06 PM <Callum@...> wrote:

Andy, Sql would be returning a different 10 records without the order by - so client side sort is not the answer.

I havent noticed this behaviour but would be interested to know if building the query in a variable as per the other suggestion sorted it out.


Re: DirectSQL removing the ORDER BY clause

Lado Wali
 

I would instead try writing the store procedure. I know this would be a very small one line stored procedure but should work.



On Thu, Dec 17, 2020 at 6:06 PM <Callum@...> wrote:
Andy, Sql would be returning a different 10 records without the order by - so client side sort is not the answer.

I havent noticed this behaviour but would be interested to know if building the query in a variable as per the other suggestion sorted it out.


Re: DirectSQL removing the ORDER BY clause

Callum Downie
 

Andy, Sql would be returning a different 10 records without the order by - so client side sort is not the answer.

I havent noticed this behaviour but would be interested to know if building the query in a variable as per the other suggestion sorted it out.


Re: XPA 4.6 Single User Edition

Andreas Sedlmeier
 

Thanks a lot for this Marvin . It only seems a bit illegal and risky if you do the distribution of this. I take the risk ;)

Now the installation hangs @Installing Internet requesters and I really hate that shit and do not want to get an MS/IIS expert anymore only to be able to do a software installation. After so many years MSE should have been able to provide a decent installation :((

I was really looking forward to see this version and adjust my sample projects.

After such a long time without Magic, I start to miss it a bit :) and I still would consider it as a nice GUI generator for my Java / GO / Typescript backends since im mainly busy with backend programming and microservices these days.

Best regards,

Andreas


Re: DirectSQL removing the ORDER BY clause

Andy Jerison
 

You're only getting ten rows, so a client-side sort will run instantaneously. That's what I'd do. 

Andy 


On Thu, Dec 17, 2020, 14:22 Avgerinos <mento@...> wrote:
Hi magicians

In XPA 3.3c, I have a simple online task that uses a Direct SQL command to select the TOP-10 records from a table:
SELECT TOP 10  [product], [price], [volume], [value]    FROM [dbo].[orders]    WHERE [product] = 'TEST'   ORDER BY [volume] DESC

When I run the program I get a different result set compared to what I 'm getting when I run the query in the Management Studio (MSSQL 2014).
By checking via the SQL profiler, I found out that Magic is removing the ORDER BY clause when executing the command.

Anyone experienced something similar? Any way to avoid?

Best regards
Avgerinos


Re: XPA 4.6 Single User Edition

Marvin VIDAL
 

Hi,

I have the file from an old download, here's the link:


I hope I have been able to help you.

Regards,

Marvin VIDAL


On Thu, Dec 17, 2020 at 8:12 AM Andreas Sedlmeier <sedlmeier@...> wrote:
Hi,

From a message here I saw that a new, 4.6 based, version of XPA Single User edition is available.

Did anybody manage to download that or did you receive your copy via different channels.

For me the download does not work.

Best Regards,

Andreas

2741 - 2760 of 196382