Jump to content

PDM Get_Row and SQL describe


stash

This topic is 6815 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

Link to comment
Share on other sites

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)B)

/////////////////////////////////

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"...

Link to comment
Share on other sites

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:

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 5 weeks later...

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"; "" )

)

Link to comment
Share on other sites

This topic is 6815 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.