stash Posted August 19, 2005 Posted August 19, 2005 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
stash Posted August 22, 2005 Author Posted August 22, 2005 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"...
stash Posted August 23, 2005 Author Posted August 23, 2005 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:
stash Posted August 23, 2005 Author Posted August 23, 2005 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.
stash Posted September 22, 2005 Author Posted September 22, 2005 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"; "" ) )
Recommended Posts
This topic is 7071 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now