• Adding element of one array at the end of anothar array

    From Marco Boschi@21:1/5 to All on Mon Jul 18 06:50:34 2022
    Hi to all!

    Is it possible to add elements of aSoloRic Array after this sequence { "ONE" , "TWO" , "THREE" , "FOUR" , "FIVE" } using a particular syntax?

    For every line of aResult Array I Have 5 fixed elements and than other elements but I don't know how many.
    aSoloRic could contain from zero to n elements


    otherwise I Create a little function to goal



    FUNCTION MAIN()

    LOCAL aSoloRic1 := {}
    LOCAL aResult := {}

    aSoloRic1 := { "0001" , "0002" , "0003" , "0004" }

    AADD( aResult , { "ONE" , "TWO" , "THREE" , "FOUR" , "FIVE" , aSoloRic1 } )

    RETURN NIL

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ariel Paredes@21:1/5 to All on Wed Jul 20 06:06:30 2022
    El lunes, 18 de julio de 2022 a las 8:50:35 UTC-5, Marco Boschi escribió:
    Hi to all!

    Is it possible to add elements of aSoloRic Array after this sequence { "ONE" , "TWO" , "THREE" , "FOUR" , "FIVE" } using a particular syntax?

    For every line of aResult Array I Have 5 fixed elements and than other elements but I don't know how many.
    aSoloRic could contain from zero to n elements


    otherwise I Create a little function to goal



    FUNCTION MAIN()

    LOCAL aSoloRic1 := {}
    LOCAL aResult := {}

    aSoloRic1 := { "0001" , "0002" , "0003" , "0004" }

    AADD( aResult , { "ONE" , "TWO" , "THREE" , "FOUR" , "FIVE" , aSoloRic1 } )

    RETURN NIL

    Hi
    try Hash

    // The example creates an associative array and deletes
    // the third key/value pair.
    PROCEDURE Main
    LOCAL hArray := Hash()
    HSetAACompatibility( hArray, .T. )
    hArray[ "One" ] := 10
    hArray[ "Two" ] := 20
    hArray[ "Three"] := 30
    hArray[ "Four" ] := 40
    hArray[ "Five" ] := 50
    ? hArray[ 3 ] // result: 30
    ? hArray["Four"] // result: 40
    HaaDelAt( hArray, 3 )
    ? hArray[ 3 ] // result: 40
    ? hArray["Four"] // result: 40
    RETURN

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dan@21:1/5 to All on Wed Jul 20 16:05:04 2022
    Il 18/07/2022 15:50, Marco Boschi ha scritto:
    Hi to all!

    Is it possible to add elements of aSoloRic Array after this sequence { "ONE" , "TWO" , "THREE" , "FOUR" , "FIVE" } using a particular syntax?

    For every line of aResult Array I Have 5 fixed elements and than other elements but I don't know how many.
    aSoloRic could contain from zero to n elements


    otherwise I Create a little function to goal



    FUNCTION MAIN()

    LOCAL aSoloRic1 := {}
    LOCAL aResult := {}

    aSoloRic1 := { "0001" , "0002" , "0003" , "0004" }

    AADD( aResult , { "ONE" , "TWO" , "THREE" , "FOUR" , "FIVE" , aSoloRic1 } )

    RETURN NIL

    LOCAL aSoloRic1 := { "0001" , "0002" , "0003" , "0004" }
    LOCAL aResult := {}
    AADD( aResult , { "ONE" , "TWO" , "THREE" , "FOUR" , "FIVE"})

    // aResult={{ "ONE" , "TWO" , "THREE" , "FOUR" , "FIVE"}}
    // aresult[1] is the first element of array aResult and it is an array
    itself. It is NOT aResult={ "ONE" , "TWO" , "THREE" , "FOUR" , "FIVE"}

    aeval(aSoloRic1,{|x|aadd(aResult[1],x)})

    // we added elements to the sub-array
    // aResult={{ "ONE" , "TWO" , "THREE" , "FOUR" , "FIVE", "0001" ,
    "0002" , "0003" , "0004" }}
    // Otherwise you obtain:
    // aResult={{ "ONE" , "TWO" , "THREE" , "FOUR" , "FIVE"},{"0001" ,
    "0002" , "0003" , "0004" }}

    HTH
    Dan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marco Boschi@21:1/5 to All on Thu Jul 21 00:44:25 2022
    Many thanks to all!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)