Jump to content

PenelopeSkye

Members
  • Content Count

    69
  • Joined

  • Last visited

Community Reputation

1 Neutral

1 Follower

Technical Information

  • Delphi-Version
    Delphi 10.3 Rio

Recent Profile Visitors

1253 profile views
  1. PenelopeSkye

    Query result to dynamic array

    Hi James, our company has paid to have our code converted to c#, so I won't be posting here anymore. I just wanted to thank you for all your help and support. If there is any feedback I can leave anywhere please let me know, but otherwise I am taking it all as a big personal favor!!!
  2. PenelopeSkye

    Query result to dynamic array

    I just got back!! Since I don't understand what you are talking about I can't weigh in, but I am very very happy to say that the code works as expected! 🙂 Thank you both for weighing in!!!
  3. PenelopeSkye

    Query result to dynamic array

    Duuuude! You are a genius!!! Thank you!!!
  4. PenelopeSkye

    Query result to dynamic array

    I tried looping through the dataset and comparing it to the value but the UI behaved very oddly, Sorry, I am not making it easy for you to help, I should probably go home and come back when I feel better!
  5. PenelopeSkye

    Query result to dynamic array

    I am not using it for the memo box. I am clicking on a field with some text. I need to compare the value from that field to a list of values from the database. Wouldn't that call for a dynamic array? Thank you!
  6. PenelopeSkye

    Query result to dynamic array

    type TMyRecToStoreSomeValues2 = record ValInt: integer; ValString: string; ValDate: TDate; // etc... end; TMyValuesInArray = TArray<TMyRecToStoreSomeValues2>; function HelloWorld: TMyValuesInArray; var LMyValue : TMyRecToStoreSomeValues2; LMyValues: TMyValuesInArray; begin LMyValues := [ dm.q_GetStockNumFromValuePackLinks.SQL.Text := 'SELECT art_status FROM [AdiMS2].[dbo].[art_status]'; // // ... // result := LMyValues; end;
  7. PenelopeSkye

    Query result to dynamic array

    I am able to loop through the result set from the query! Thank you both so much!!!
  8. PenelopeSkye

    Query result to dynamic array

    Ah! Got it! Thanks!
  9. PenelopeSkye

    Query result to dynamic array

    Thank you both. I get the master presentation from one table using FieldByName. I use that master presentation to get anywhere from 1 to 8 presentations from a second table. Then I need to loop through the dynamic list of presentations and update the row in the second table. How would I get a dataset with this information without using a query?
  10. PenelopeSkye

    Query result to dynamic array

    Thanks James!!! Unfortunately I haven't successfully gotten the query results into the dynamic array. Did you explain how above and I'm so ignorant I didn't see it? That is entirely possible!!!!!
  11. PenelopeSkye

    Query result to dynamic array

    I need to loop through a dynamic array which is populated by the result of a query. I have gotten as far as what you see below, but I keep getting an error Incompatible types: 'Char' and 'Variant' at the end of the following line Result := q_InsValuePackLinks2.Fields[i].Value; I have to admit that I changed a lot of this messing around to the point where I don't know what other parts are wrong, so I thought I'd ask for help! How do I create a dynamic array from q result set? Thanks! procedure TfDesignMaster.btnVP_PostClick(Sender: TObject); var b: array of string; Begin var i,j,numberOfFields: integer; var PresentationID,designid,master_pres,result,presentations:string; with dm do begin master_pres :=q_GetStockNumFromValuePackLinks.FieldByName('master_presentation').AsString; q_InsValuePackLinks2.SQL.Add('select presentation from presentation_master where master_presentation = '+master_pres); q_InsValuePackLinks2.Open; presentations := q_InsValuePackLinks2.Fields.ToString; SetLength(Result,i); for i := 0 to q_InsValuePackLinks2.Fields.Count - 1 do Result[i] := q_InsValuePackLinks2.Fields[i].Value; end; end;
  12. PenelopeSkye

    Must have multiple var sections

    Doh! It should have been obvious that that button is what brackets code! Thank you! I am going to start studying the code you gave my above until I understand it, thanks again James!
  13. PenelopeSkye

    Must have multiple var sections

    Hi James, I hope you will see this, I will wait a bit then post is in a new topic. I have a table with the following fields. It was not my design choice but I was overruled. I needed to search every pack_component field in every row for a specific value, so I chose union to bring that about. You gave me most of the code I used to create this procedure which finds the value and its' position and display it in a memo box. The code works perfectly but every now and then I get the attached error. Can you tell me why since the code works? Thank you! [vp_id] ,[Presentation] ,[Design_id] ,[Stock_pack] ,[Order1],[Pack_component1],[Qty1] ,[Order2],[Pack_component2],[Qty2] ,[Order3],[Pack_component3],[Qty3] ,[Order4],[Pack_component4],[Qty4] ,[Order5],[Pack_component5],[Qty5] ,[Order6],[Pack_component6],[Qty6] ,[Order7],[Pack_component7],[Qty7] ,[Order8],[Pack_component8],[Qty8] ,[Order9],[Pack_component9],[Qty9] ,[Order10],[Pack_component10],[Qty10] ,[Order11],[Pack_component11],[Qty11] ,[Order12],[Pack_component12],[Qty12] procedure TfDesignMaster.PopulatePdlNotesWithValuePack2(Sender: TObject); begin //var designid: string; var stocknummm,LText1,LText2,StockFromVP: string; var F: TField; stocknummm := dm.tb_design_master.fieldbyname('jmc_stock_num').asstring; StockFromVP := dm.tblValuePackLinks.fieldByName('Stock_pack').asString; Panel35.Visible :=false; Memo1.Clear; //ShowMessage(stocknummm); with dm do begin q_GetStockNumFromValuePackLinks.SQL.Clear; q_GetStockNumFromValuePackLinks.SQL.Add('select Stock_pack,stockOrder = 1 from ValuePackLinks where Pack_component1 = ' +stocknummm ) ; q_GetStockNumFromValuePackLinks.SQL.Add('union' ) ; q_GetStockNumFromValuePackLinks.SQL.Add('select Stock_pack,stockOrder = 2 from ValuePackLinks where Pack_component2 = ' +stocknummm ) ; q_GetStockNumFromValuePackLinks.SQL.Add('union ' ) ; q_GetStockNumFromValuePackLinks.SQL.Add('select Stock_pack,stockOrder = 3 from ValuePackLinks where Pack_component3 = ' +stocknummm ) ; q_GetStockNumFromValuePackLinks.SQL.Add('union ' ) ; q_GetStockNumFromValuePackLinks.SQL.Add('select Stock_pack,stockOrder = 4 from ValuePackLinks where Pack_component4 = ' +stocknummm ) ; q_GetStockNumFromValuePackLinks.SQL.Add('union ' ) ; q_GetStockNumFromValuePackLinks.SQL.Add('select Stock_pack,stockOrder = 5 from ValuePackLinks where Pack_component5 = ' +stocknummm ) ; q_GetStockNumFromValuePackLinks.SQL.Add('union' ) ; q_GetStockNumFromValuePackLinks.SQL.Add('select Stock_pack,stockOrder = 6 from ValuePackLinks where Pack_component6 = ' +stocknummm ) ; q_GetStockNumFromValuePackLinks.SQL.Add('union' ) ; q_GetStockNumFromValuePackLinks.SQL.Add('select Stock_pack,stockOrder = 7 from ValuePackLinks where Pack_component7 = ' +stocknummm ) ; q_GetStockNumFromValuePackLinks.SQL.Add('union' ) ; q_GetStockNumFromValuePackLinks.SQL.Add('select Stock_pack,stockOrder = 8 from ValuePackLinks where Pack_component8 = ' +stocknummm ) ; q_GetStockNumFromValuePackLinks.SQL.Add('union' ) ; q_GetStockNumFromValuePackLinks.SQL.Add('select Stock_pack,stockOrder = 9 from ValuePackLinks where Pack_component9 = ' +stocknummm ) ; q_GetStockNumFromValuePackLinks.SQL.Add('union' ) ; q_GetStockNumFromValuePackLinks.SQL.Add('select Stock_pack,stockOrder = 10 from ValuePackLinks where Pack_component10 = ' +stocknummm ) ; q_GetStockNumFromValuePackLinks.SQL.Add('union' ) ; q_GetStockNumFromValuePackLinks.SQL.Add('select Stock_pack,stockOrder = 11 from ValuePackLinks where Pack_component11 = ' +stocknummm ) ; q_GetStockNumFromValuePackLinks.SQL.Add('union' ) ; q_GetStockNumFromValuePackLinks.SQL.Add('select Stock_pack,stockOrder = 12 from ValuePackLinks where Pack_component12 = ' +stocknummm ) ; //ShowMessage( q_GetStockNumFromValuePackLinks.SQL.Text) ; q_GetStockNumFromValuePackLinks.Open; while not q_GetStockNumFromValuePackLinks.EOF do begin for F in q_GetStockNumFromValuePackLinks.Fields do begin LText1 := ''; // for var i: integer := 0 to (q_GetStockNumFromValuePackLinks.Fields.Count - 1) do // field name + field value LText1 := q_GetStockNumFromValuePackLinks.Fields[0].Value; LText2 := q_GetStockNumFromValuePackLinks.Fields[1].Value; //ShowMessage(LText1); dm.q_GetStockNumFromValuePackLinks.Next; // to avoid "infinity looping" and catch next values... end; //ShowMessage(LText1); if q_GetStockNumFromValuePackLinks.Fields[0].Value <> '' then Panel35.Visible :=true else Panel35.Visible :=false; q_GetStockNumFromValuePackLinks.Next; end; Memo1.Lines.Add('Bag '+stocknummm+' is in Value Pack ('+LText1+') in Position (' +LText2+')' ); q_GetStockNumFromValuePackLinks.Close; end; end;
  14. PenelopeSkye

    Find all mentions of the database

    I created a test database and pointed the connection string to it, and I found 1 other place where the database name is mentioned after searching in all files. Unfortunately although some of the code works to insert into the database, not everything does, and I am thinking that there are other places indicating the database that I am not finding by using the search function. Does anyone know how to find other places where code is pointed to a database or do I need to search through every object? Thanks!
  15. PenelopeSkye

    Refresh dbedit after insert

    LOL!!! Will do!
×