Return Result of DB Read Step (UCCX 5.0(2))

Answered Question
Jul 16th, 2008
User Badges:

Hi,


is it possible to get the information from a DB Read Step how many results the query founds. I can only see the number of results when I test the query, but I want to store the number of results in a variable!


System: UCCX 5.0(2)


Regards


alex


Correct Answer by BCOLE2007 about 8 years 10 months ago

Hi Alexander,


Option1:Database View

1)Create a view with the Select count(*) from table in it, name the field in the view definition. Test the view


2) Refresh your CRS schema,


3) use the View in your DbRead and DBGet




Option 2: Database Table

1) In the SQL for the DBread give the count(*) a name ,


select count(*) as total from table


2)On your database, create a table to use as a Work Record, name the field the same as the select statements as.

This will never have any records in it and you will use in your DBget


2.5) Refresh your schema to see the Work Record


3) In your DB Get at the Table/View drop down

pick your Work Record table and map it to the CRS variable you want to capture the count into.


I tend to use Option 2, creating 1 Work Record with multiple fields in it to use for a variety of SQL statements, ensuring to name them the same in the Select.


Please rate this post if it helps

Blair


  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 4 (1 ratings)
Loading.
jpsweeney77 Wed, 07/16/2008 - 08:34
User Badges:
  • Bronze, 100 points or more

Have you tried a Select Count(*) SQL statement?

alexander.teske Thu, 07/17/2008 - 00:44
User Badges:

Yes, but in the DB Read Step I can't define the variable, where the result is stored!

Correct Answer
BCOLE2007 Thu, 07/17/2008 - 10:41
User Badges:
  • Bronze, 100 points or more

Hi Alexander,


Option1:Database View

1)Create a view with the Select count(*) from table in it, name the field in the view definition. Test the view


2) Refresh your CRS schema,


3) use the View in your DbRead and DBGet




Option 2: Database Table

1) In the SQL for the DBread give the count(*) a name ,


select count(*) as total from table


2)On your database, create a table to use as a Work Record, name the field the same as the select statements as.

This will never have any records in it and you will use in your DBget


2.5) Refresh your schema to see the Work Record


3) In your DB Get at the Table/View drop down

pick your Work Record table and map it to the CRS variable you want to capture the count into.


I tend to use Option 2, creating 1 Work Record with multiple fields in it to use for a variety of SQL statements, ensuring to name them the same in the Select.


Please rate this post if it helps

Blair


Actions

This Discussion