August 19, 200520 yr This is a real fun that I got of PDM plugin. Instead to get retreived each row of this simple SQL query I'm getting each second row. Does anyone share my experience or better if has a tip about this situation? Hvala(Thanks)! SetField[Field_Desc; External ( "SQL-execQuery"; "DESC Table_Name" )] Loop SetField[Field_Get_Row;External ( "SQL-getRow"; "" )] ExitLoopIf EndLoop
August 22, 200520 yr Author Might be the tip for next "victime at the same trap". It doesnt work well with the loop. So, instead to loop, make several copy-paste (depending on number of expected results) ///////////////////////////////// If (Field_Get_Row = "EMPTY") exit endif SetField[Field_Get_Row;External ( "SQL-getRow"; "" )] If (Field_Get_Row = "EMPTY") exit endif SetField[Field_Get_Row;External ( "SQL-getRow"; "" )] /////////////////////////// Ugly solution like a pain. Might be better to figure out Recursive function which will make calls to the "SQL-getRow"...
August 23, 200520 yr Author One simple solution with recursive custom function: Custom function named as: ST_PDM_Get_Row. Without paramethers. Let ( $GET_ROW = External ( "SQL-getRow"; "" ); Case ( PatternCount ( $GET_ROW; "EMPTY" ) = 0; ST_PDM_Get_Row ( ) & ¶ & $GET_ROW; $GET_ROW ) ) So, when you have to call it in a script, first make SQL query and then: SetField [some_Global_Field; ST_PDM_Get_Row()] After you get retreived SQL records in global field first have to substitute "EMPTY" with "" and then, if needed, to parse out each separate record to the supposted non-global fields. Works out in me case. :tigger:
August 23, 200520 yr Author Ups, little correction: Let ( $GET_ROW = External ( "SQL-getRow"; "" ); Case ( PatternCount ( $GET_ROW; "EMPTY" ) = 0; ST_PDM_Get_Row ( ) & ¶ & $GET_ROW; "" ) ) In this case you dont need to get rid off(substitute) "EMPTY" in retreived result array.
September 22, 200520 yr Author One WARNING about using this custom function! There is some unexpectable limitation on amount of retreived data. The recommended amount is "middle size" of data. Test this solution on your case before applay it. This is most simple solution and these kind are always most stable in programming: Case ( External ( "SQL-getRow"; "" ) = "EMPTY"; ""; ST_PDM_Get_Row ( ) & ¶ & External ( "SQL-getRow"; "" ) )
Create an account or sign in to comment