cancel
Showing results for 
Search instead for 
Did you mean: 

Verify Source Counts and then start data load

Former Member
0 Kudos

I want to verify my Source Counts. only if count is greater than 0 , i would like to continue with DF, which will load the dat ainto my destination.

How can i accomplish this in BODS

Accepted Solutions (1)

Accepted Solutions (1)

former_member189153
Active Participant
0 Kudos

This message was moderated.

Former Member
0 Kudos

Ramesh,

i tired the function you specified and got the count value in a variable. Now how can i do the next step ?

can i use the conditional task for this ?

in that case how in the script , i can stop the job ?

Former Member
0 Kudos

Hey Samuel,

You can allow a job to execute which will basically feed data to your variable .

Use conditional Data flow logic based on your variable value.

If variable_value>0 than Actual DF else a script with message no data in the source.

Your job will always execute but the DF having the actual logic will be skipped based on your variable value.

Thanks

Gaurav

former_member189153
Active Participant
0 Kudos

Hi,

You can do this using conditional palette, pick the Conditional palette into Job/Workflow area and apply the logic to execute respective Dataflow as below.

Add Condition in If area

Regards

M Ramesh

Answers (2)

Answers (2)

akhileshkiran
Contributor
0 Kudos

Hi

By using Conditional Workflow you can achieve this please follow the below screen shorts.

Create a Global Variable and Data Type as int. Take a Conditional Work Flow and connect a Script (S_Count) in-front of the Conditional Work Flow as mentioned in the above Screenshot..

Write Script initiating the Global Variable with the count of the table as above mentioned screen short.

Open Conditional Workflow. Write a Statement if Global Variable = 0.
Then it will  run the S_Stop script as a Print statement 'Table is empty'

The S_Stop Script as follows.

In Else Workspace am taking my Data flow. Which is should be Executed if the source table is not empty.

Output:

If Source table is Empty.


If Source Table is having data.

Former Member
0 Kudos

in this scenario, if the count is equal to 0 , i want to fail my job with a specific error message.how can i fail the job in BODS

akhileshkiran
Contributor
0 Kudos

Hi

You can write a statement/ Raise Exception in script.
instead of print change it to raise_exception.

Write this is S_Stop Script.

raise_exception('Table is Empty');

Output:

Regards,

Akhileshkiran.

Former Member
0 Kudos

Hi Sam,

You can achieve this by using a script before the dataflow.

In the script use a variable which will be 1,based on data returned from the sql function.

i.e. if count() >0 than 1 else 0.

Now use this variable's value to execute or skip the Dataflow in the sequence based on he value it has..

You can use SCRIPT--> IF ELSE-->DF1 or DF2....

Gaurav