Link to home
Start Free TrialLog in
Avatar of sushmasriram
sushmasriram

asked on

powerscript question

Below is my code. I am getting three C0031: syntax errors on lines 86,86 and 88. I am unable to figure out why. Please help.



integer      row_count, li_downtime, i, ll_cnt
date            ldt_begin_date, ldt_end_date, temp_date
string      machine_num, setting

st_date_machine      st_date_machine

open( w_calendar_range_response_mach )

st_date_machine = message.powerobjectparm

If IsValid(Message.PowerObjectParm) and Not IsNull(Message.PowerObjectParm) Then
     If ClassName(Message.PowerObjectParm) = 'st_date_machine' Then
          st_date_machine = message.powerobjectparm
     Else
          MessageBox("Error","Returned object is not valid")
          Return -1
     End If
Else
     MessageBox("Error","Nothing Returned")
     Return -1
End If

ldt_begin_date = st_date_machine.st_begin_date
ldt_end_date = st_date_machine.st_end_date
machine_num = st_date_machine.st_machine_id
if machine_num <> '-1' then
      if ldt_begin_date > 1949-01-01 and ldt_end_date > 1949-01-01 then
      temp_date = ldt_begin_date
      do while temp_date <= ldt_end_date
      select sum(downtime_minutes)  
    into :li_downtime  
    from machine_downtime  
   where ( machine_id = :machine_num ) and  
         ( capture_date = :temp_date );
                  
                  if li_downtime > 1 then
                        row_count++
                  end if

            temp_date =relativedate(temp_date,1)      
      loop      
      tab_1.tabpage_1.dw_1.settransobject( sqlca )
      tab_1.tabpage_1.dw_1.retrieve( ldt_begin_date, ldt_end_date, machine_num, row_count )
      tab_1.tabpage_2.dw_2.settransobject( sqlca )
      tab_1.tabpage_2.dw_2.retrieve( ldt_begin_date, ldt_end_date, machine_num, row_count )
      
      
else
      
end if
end if

Datastore ds_all
ds_all = Create Datastore
ds_all.DataObject = 'dw_all_machine'  //the SQL for this DW is 'Select distinct machine_id from machine_downtime'
ds_all.SetTransObject(SQLCA)

if machine_num = '%' then
      ll_Cnt  = ds_all.Retrieve()
For i = 1 to ll_Cnt
machine_num = ds_all.Object.machine_id[i]
if ldt_begin_date > 1949-01-01 and ldt_end_date > 1949-01-01 then
     temp_date = ldt_begin_date
     do while temp_date <= ldt_end_date
     select sum(downtime_minutes)  
    into :li_downtime  
    from machine_downtime  
   where ( machine_id = :machine_num ) and  
         ( capture_date = :temp_date );
               
               if li_downtime > 10 then
                    row_count++
               end if

          temp_date =relativedate(temp_date,1)    
     loop
      tab_1.tabpage_1.dw_1.settransobject( sqlca )
      tab_1.tabpage_1.dw_1.retrieve( ldt_begin_date, ldt_end_date, machine_num, row_count )
      tab_1.tabpage_2.dw_2.settransobject( sqlca )
      tab_1.tabpage_2.dw_2.retrieve( ldt_begin_date, ldt_end_date, machine_num, row_count )
      
      
else
      
end if
end if
ASKER CERTIFIED SOLUTION
Avatar of diasroshan
diasroshan
Flag of Kuwait image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sushmasriram
sushmasriram

ASKER

I am not getting any errors now. But when I choose all option, the row_count value is not getting retrieved. I m getting 0 as the value. row count is to calculate the number of production days. To calculate this, we used the logic that if the downtime registered is more than 10 minutes, count the day as a production day. we use this row count value in our report to calculate the scheduled production hours. Now with the logic above, it is retrieving good values for individual machines but for ALL, it is giving a 0 value. Please help.
Hi,

the code looks alrite to me...
do me a favour... can u debug thru the code and check if the code is entering the For loop and then the Do While Loop...

Also tell the value of  ll_Cnt  = ds_all.Retrieve()


Cheers,
Rosh
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial