Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Can someone test something in AA for MS SQL?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • madtowng
    replied
    I presumed the alphadao import was putting data into the sql db.

    Leave a comment:


  • Alan Lee
    replied
    no inserts just selects.

    Leave a comment:


  • madtowng
    replied
    I would suggest using a bulk insert routine instead. They are usually quicker and they give you more control over your data.
    I gave up on most alpha sql work because of too many things I wasn't happy with (even though they may have changed them by now).

    Leave a comment:


  • Alan Lee
    replied
    I have used this AlphaDAO import before for spreadsheets but never thought, or had a reason, to use it for this. The "create a new passive link table" from the control panel always worked. It's a little cumbersome because the dialog box you work in is rather small but until now it worked. The xbasic way is an extra step but actually better because you can really see and tweak it.

    I sent a simple example that was documented step by step how to reproduce. I am fairly certain you are correct that it is a bug in the UI. The other way works for 98% of what I do. But the 2% is very, very important.

    Thanks for the tip! Very much appreciated and that probably would not have occurred to me.

    Leave a comment:


  • Al Buchholz
    replied
    Originally posted by Alan Lee View Post
    Hmmmm, I think I have found a work around using AlphaDAO import. I build most of the import using the genie, dump it out as Xbasic, paste my query in the SQLSelect statement, run the script once to create passive table. You can right click to refresh. You can edit the SQLSelect in the script and rerun the script to alter the passive table. Once the table matches the SQLSelect then just right click to refresh or refresh via Xbasic. In a way a pain but in another way better because the SQL is easier to read in script than in the Source Editor. I'm going to tinker with it a little more but I think it's usable.
    That is what I was suggesting as a way that I do this.

    Looks like that is avoiding the Alpha user interface where the error might be generated from.

    The underlying method works, just not the user interface...

    I found a message that the user interface was updated a little while ago.

    Send this as an example of a bug and see what response you get from Alpha.

    Leave a comment:


  • madtowng
    replied
    Sorry about that...I was hoping to see the code under the error.
    With that said, are there any rows with null values in the column(s) you're using in the statement.
    I can experiment, but it would really be helpful to have your data, and preferably the create table
    definition for the table involved.

    Leave a comment:


  • Alan Lee
    replied
    I am pretty sure that message is not valid because i execute the query in a number of places, SSMS for sure, and MS SQL executes it without hesitation. I am 99.9% sure the query or the server are not the problem.

    Thanks!!

    Leave a comment:


  • Alan Lee
    replied
    Below is the script that works. SQL is in it.

    dim connectionString as c
    connectionString = "::Name::dwp"

    delete options
    dim options as p
    options.ConsolidateArguments= .t.
    options.AddTablesToDatabase= .t.
    options.ShowProgress= .t.
    options.AllowCancel= .t.


    delete a_import
    dim a_import[0] as p


    a_import[].ObjectName = "<Custom SQL Query>"
    a_import[..].SQLSelectStatement = <<%sql%
    SELECT
    stf.Source_Id,
    stf.Company_Num,
    stf.Customer_Num,
    cx.Customer_Name,
    cx.Credit_hold_flag,
    cx.Sales_Person_1_Key,
    spd.Sales_Person_Name,
    stf.Ship_To_Address_Key,
    cad.address_type,
    cad.Ship_To_Name,
    cad.Ship_To_Num,
    cad.Address_1,
    cad.Address_2,
    cad.Address_3,
    cad.City,
    cad.State,
    cad.Zip,
    Min(stf.Invoice_Date_Key) AS dt_first_sale,
    Max(stf.Invoice_Date_Key) AS dt_last_sale,
    Sum(case when dd.year_num=2018 then stf.Extended_Price else 0 end) AS sales_2018,
    Sum(case when dd.year_num=2018 then (stf.Extended_Price - stf.Extended_Cost)else 0 end) AS gp_2018,
    Sum(case when dd.year_num=2019 then stf.Extended_Price else 0 end) AS sales_2019,
    Sum(case when dd.year_num=2019 then (stf.Extended_Price - stf.Extended_Cost)else 0 end) AS gp_2019,
    Sum(case when dd.year_num=2020 then stf.Extended_Price else 0 end) AS sales_2020,
    Sum(case when dd.year_num=2020 then (stf.Extended_Price - stf.Extended_Cost)else 0 end) AS gp_2020
    FROM Sales_Transaction_Fact as stf
    LEFT OUTER JOIN Customer_Xref as cx
    on stf.source_id=cx.source_id and stf.company_num=cx.company_num and stf.customer_num=cx.customer_num
    LEFT OUTER JOIN Sales_Person_Dim as spd
    ON cx.Sales_Person_1_Key = spd.Sales_Person_Key
    LEFT OUTER JOIN Customer_Address_Dim as cad
    ON stf.Ship_To_Address_Key = cad.Customer_Address_Key
    LEFT OUTER JOIN Company_Dim as cd
    ON stf.Company_Key = cd.Company_Key
    INNER JOIN Date_Dim as dd
    ON stf.Invoice_Date_Key = dd.Date_Key
    where stf.Source_Id='aplus'
    GROUP BY
    stf.Source_Id,
    stf.Company_Num,
    stf.Customer_Num,
    cx.Customer_Name,
    cx.Credit_hold_flag,
    cx.Sales_Person_1_Key,
    spd.Sales_Person_Name,
    stf.Ship_To_Address_Key,
    cad.address_type,
    cad.Ship_To_Name,
    cad.Ship_To_Num,
    cad.Address_1,
    cad.Address_2,
    cad.Address_3,
    cad.City,
    cad.State,
    cad.Zip
    %sql%
    a_import[..].SQLType = "Native"
    a_import[..].Arguments = ""
    a_import[..].ImportType = "Create passive-link table"
    a_import[..].LocalTableName = a5.get_path() + chr(92) + "sql_test_4"+".dbf"
    a_import[..].LocalTableFieldDef = ""
    a_import[..].OverwriteOption = "Overwrite without prompting"


    dim flagSilent as l
    delete args
    dim args as sql::arguments
    flagSilent = .f.
    delete p
    dim p as p

    p = a5_AlphaDAO_Import(connectionString,a_import,options,flagSilent,args)
    'p has an .hasError and .errorText property
    'a_import[] has the following properties for each item: .countRecordsImported, .hasError, .errorText, .userCancelled


    Leave a comment:


  • Alan Lee
    replied
    Hmmmm, I think I have found a work around using AlphaDAO import. I build most of the import using the genie, dump it out as Xbasic, paste my query in the SQLSelect statement, run the script once to create passive table. You can right click to refresh. You can edit the SQLSelect in the script and rerun the script to alter the passive table. Once the table matches the SQLSelect then just right click to refresh or refresh via Xbasic. In a way a pain but in another way better because the SQL is easier to read in script than in the Source Editor. I'm going to tinker with it a little more but I think it's usable.

    Leave a comment:


  • madtowng
    replied
    Now that we can see the error being supplied by sql server, it would help to see the actual sql code.

    Leave a comment:


  • Alan Lee
    replied
    AlphaDAO import does the same thing.

    When I paste the below query in the select records I can preview records and it works but when I click OK I get the error.

    select item_num,
    sum(case when qty_shipped<100 then Qty_Shipped else 0 end) as total_qty_lt_100,
    sum(case when qty_shipped>=100 then Qty_Shipped else 0 end) as total_qty_ge_100
    from Sales_Transaction_Fact
    where item_num in ('primpof111','primpof4612') and Invoice_Date_Key between 20200101 and 20200131
    group by Item_Num

    sql_preview.pngsql_error.png
    Attached Files

    Leave a comment:


  • Alan Lee
    replied
    Can you try to build and edit one with a case statement like I mentioned above? It doesn't like the embedded case statement now for some reason.

    How long does it usually take to get a reply on a bug report?

    Leave a comment:


  • Al Buchholz
    replied
    I build most passive linked tables with an import operation using AlphaDAO.

    Then you can modify the operation or create xbasic to use in a script or User Defined Function.

    Gives me a lot more options of how to modify what is happening.

    Leave a comment:


  • Alan Lee
    replied
    I can't find anything. If I could find an Alpha command that would allow you to edit an existing passive table via Xbasic I would be OK. I found how to create one but it does not allow you to edit an existing one.

    Leave a comment:


  • Ted Giles
    replied
    Look at the documentation about Passive Link Tables. There are options there for editing the scrips.

    Leave a comment:

Working...
X