Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE
Absent Member.. sreedevireddy Absent Member..
Absent Member..
846 views

error in wizard code

Hi,

 

I have declared two variables as below.

{ String g_sHDSStatus   Value = "" }

{ String g_sStateOfOperation   Value = "" }

 

Page details code

 

{ Page pgGetData
  Title = retval = "Control Unlinking of Data Records"
  { Label lblCurrTrans
    Caption = RetVal = "<FONT COLOR=#2200bb><b><FONT SIZE=+2>" &"Unlink and Delete Record: " &{g_sSelRecord} &" from " &[CUrrentTable] &"<FONT COLOR=#000000><FONT SIZE=-4></B><FONT SIZE=-2>"
  }
  { Label lblErrMessage
    Caption = RetVal = "<FONT COLOR=#ee0022><b><FONT SIZE=+2>" &"Illegal attempt to unlink a record from an HDS with Status: " &{g_sHDSStatus} &"<FONT COLOR=#000000><FONT SIZE=-4></B><FONT SIZE=-2>"
    Visible = RetVal = {g_sStateOfOperation} = "BLOCK"
    Yoffset = 500
  }
  { Label lblOKMsg
    Caption = RetVal = "<FONT COLOR=#2200bb><b><FONT SIZE=+2>" &"Press the OK key to unlink the currently selected record. The record will also be deleted." &"<FONT COLOR=#000000><FONT SIZE=-4></B><FONT SIZE=-2>"
    Visible = RetVal = {g_sStateOfOperation} = "OK"
  }
}

 

here my requirement is when {g_sHDSStatus}="Daft" I dont want to dispaly page

or  {g_sStateOfOperation} = "Block" I  want this page

 

so I tried to modified code in "To" as below

 

{ To =
    if {g_sStateOfOperation} = "BLOCK" then
       'RetVal="pgGetData"
     end if
      }

 

 

 I am getting the following error.

 

"The wizard does not have any pages defined"

 

please find the error screen shot .

 

Can any one suggest how to put if condition in "To"..

0 Likes
11 Replies
Acclaimed Contributor.. Mark Cullen_1 Acclaimed Contributor..
Acclaimed Contributor..

Re: error in wizard code

If your transition node is coded outside of a page node then you need a "Start" along with "To".

0 Likes
Absent Member.. sreedevireddy Absent Member..
Absent Member..

Re: error in wizard code

in "start" only  i defined "To"

 

 

 

{ Start Start
  { Do = 
   
    Dim sSatFKQry       as String
    Dim sSatTabName     as String
   
    sSatTabName          = [CurrentTable]
   
    Dim sSatPK          as String
    sSatPK               = amGetFieldSQLName(amGetMainField(amGetTableFromName(sSatTabName)))
        
    Dim sSatTabFKList   as String
    sSatTabFKList        = "lCompId|lComputerAdaptersId|lComputerPhysicalId|lComputerPortsId|lComputersId=amNetworkCard,lComputerUsersId=amSysUser,lComputerId=amReference,lCompId|lComputerArrayId|lComputerDiscId|lComputerSanId=amPhysicalDrive,lComputerAutoId|lComputerHostId|lComputerUserGrpId=amNaming,lComputerGroupsId|lMyComputerId=amGroupMember,lComputerSystemId=amFileSystem,lComputerConfigId=amFirewallPolicy,lCompId|lMyComputerId|lVendorId=amExtensionCard,lComputerAccountId|lComputerAutoId|lComputerBackupId|lComputerBarcodeId|lComputerBinariesId|lComputerConfigId|lComputerDataId|lComputerDetailBPId|lComputerDiskId|lComputerDriveId|lComputerDuplicId|lComputerEncryptId|lComputerHostId|lComputerHostPropId|lComputerHPSAId|lComputerLicensedId|lComputerLifecycleId|lComputerLocalId|lComputerLTO4Id|lComputerMediaId|lComputerMseoId|lComputerNFSId|lComputerOptionId|lComputerOtherId|lComputerPolicyId|lComputerRegId|lComputerRepConfigId|lComputerScriptId|lComputerSwitchId|lComputerSymantecId|lComputerSystemId|lComputerTapeId|lComputerTeamingId|lComputerThrottleId|lComputerTimeId|lComputerTouchId|lComputerTunableId|lComputerVaultId|lComputerVMId|lMyComputerId=amDeviceDetail,lCompId|lComputerAdditionalId|lComputerGroupId|lComputerLVMId|lComputerPartitionId|lComputerPoolId|lComputerStorageId|lComputerVTLId|lPortfolioId=amLogicalDrive,lCanInstallId|lCommentId|lComputerId|lComputerJobsId|lComputerLicId|lItemId|lParentPortfolioId=amSoftInstall"
     
    sSatFKQry = sublist(sSatTabFKList, sSatTabName, "*")
    'Replace the vertical bars with commas
    sSatFKQry = Replace(sSatFKQry, "|", ",")
      sSatFKVals = amDBGetList("SELECT " &sSatFKQry &" FROM " &sSatTabName &" WHERE " &sSatPK  &" = " &[CurrentSelection] , "|", ",", "=")
      for i = 1 to CountValues(sSatFKVals, "|", "\")
            if GetListItem(sSatFKVals, "|", i) <> "0" then
          sSatFKName = sublist(sSatTabFKList, sSatTabName, i)
                  sSatFK      = GetListItem(sSatFKVals, "|", i)
                  sSatFK = LeftPart(sSatFK, "=")
                  EXIT FOR
       end if  
    next
          sHDSStatus = amDBGetString("SELECT Portfolio.Asset.Status FROM amComputer WHERE lComputerId = " &CLng(sSatFK), ",")
    lRC = amSetProperty("g_sHDSStatus", sHDSStatus)
    
      sTabVals  = amDBGetString("SELECT Self FROM " &sSatTabName &" WHERE " &sSatPK &" = " &[CurrentSelection], ",")
    lRC = amSetProperty("g_sSelRecord", sTabVals)
   
   
    If sHDSStatus <> "Draft" AND sHDSStatus <> "Rejected" AND sHDSStatus <> "Template" then
       lRC = amSetproperty("g_sStateOfOperation", "BLOCK")
    else
       lRC = amSetproperty("g_sStateOfOperation", "OK")
    end if
  }
  { To =
    if {g_sStateOfOperation} = "BLOCK" then
       'RetVal="pgGetData"
 AmMsgBox(&{g_sStateOfOperation})
       EXIT FUNCTION
    end if
    }

}

{ Page pgGetData   Title = retval = "Control Unlinking of Data Records"   { Label lblCurrTrans     Caption = RetVal = "<FONT COLOR=#2200bb><b><FONT SIZE=+2>" &"Unlink and Delete Record: " &{g_sSelRecord} &" from " &[CUrrentTable] &"<FONT COLOR=#000000><FONT SIZE=-4></B><FONT SIZE=-2>"   }   { Label lblErrMessage     Caption = RetVal = "<FONT COLOR=#ee0022><b><FONT SIZE=+2>" &"Illegal attempt to unlink a record from an HDS with Status: " &{g_sHDSStatus} &"<FONT COLOR=#000000><FONT SIZE=-4></B><FONT SIZE=-2>"     Visible = RetVal = {g_sStateOfOperation} = "BLOCK"     Yoffset = 500   }   { Label lblOKMsg     Caption = RetVal = "<FONT COLOR=#2200bb><b><FONT SIZE=+2>" &"Press the OK key to unlink the currently selected record. The record will also be deleted." &"<FONT COLOR=#000000><FONT SIZE=-4></B><FONT SIZE=-2>"     Visible = RetVal = {g_sStateOfOperation} = "OK"   } }

{ Finish Finish   { Do =     Dim lRC           as Long     Dim hR            as Long     Dim sSatPK        as String     Dim sSatTabName   as String     sSatTabName        = [CurrentTable]     if {g_sStateOfOperation} = "BLOCK" then        RetVal = -1        EXIT FUNCTION     end if             hR = amGetRecordFromMainId([CurrentTable], [CurrentSelection]) sSatPK = amGetFieldSQLName(amGetMainField(amGetTableFromName(sSatTabName)))

amLog "Delete stmt: " &"DELETE FROM " &[CurrentTable] &" WHERE " &sSatPK &" = " &[CurrentSelection]
      lRC = amDBExecAQL("DELETE FROM " &[CurrentTable] &" WHERE " &sSatPK &" = " &[CurrentSelection])
  }
  Summary = 0
}
   

0 Likes
Acclaimed Contributor.. Mark Cullen_1 Acclaimed Contributor..
Acclaimed Contributor..

Re: error in wizard code

So you do have a Start node; which is what the error is claiming.  Just as the error states a page needs to be defined so try...

 

IF {g_sStateOfOperation} = "BLOCK" THEN
   'RetVal="pgGetData" ---NOT SURE WHY THIS IS COMMENTED OUT AS A PAGE NEEDS TO BE DEFINED
   AmMsgBox(&{g_sStateOfOperation})

ELSE

   RetVal = "FINISH"

END IF

 

I have never used "EXIT FUNCTION", not that it can't work, so add logic to FINISH.DO to account for nothing to process.

0 Likes
Absent Member.. sreedevireddy Absent Member..
Absent Member..

Re: error in wizard code

I modified code like this

{To =
IF {g_sStateOfOperation} = "BLOCK" THEN
RetVal="pgGetData"

ELSE

RetVal = "FINISH"

END IF

}

still same issue
0 Likes
Acclaimed Contributor.. Mark Cullen_1 Acclaimed Contributor..
Acclaimed Contributor..

Re: error in wizard code

Attach the whole wizard text as a file to this thread.  Do not copy/paste text into post.

0 Likes
Absent Member.. sreedevireddy Absent Member..
Absent Member..

Re: error in wizard code

find the attached code and error

0 Likes
Acclaimed Contributor.. Mark Cullen_1 Acclaimed Contributor..
Acclaimed Contributor..

Re: error in wizard code

There could be a timing issue in that your variable is not set before the Start.To tries to read.  Code the To without the variable...

 

    If sHDSStatus <> "Draft" AND sHDSStatus <> "Rejected" AND sHDSStatus <> "Template" then
       RetVal = "pgGetData"
    else
       RetVal = "FINISH"

    end if

0 Likes
Acclaimed Contributor.. Mark Cullen_1 Acclaimed Contributor..
Acclaimed Contributor..

Re: error in wizard code

Or you can try...

 

amSetproperty("g_sStateOfOperation.VALUE", "BLOCK")

 

Or place the variable nodes AFTER the Start node.

0 Likes
Acclaimed Contributor.. Mark Cullen_1 Acclaimed Contributor..
Acclaimed Contributor..

Re: error in wizard code

Or move the whole Start.Do to Start.To and set variables in the final IF-THEN-ELSE along with page reference...

 

If sHDSStatus <> "Draft" AND sHDSStatus <> "Rejected" AND sHDSStatus <> "Template" then
   lRC = amSetproperty("g_sStateOfOperation", "BLOCK")
   RetVal="pgGetData"
else
   lRC = amSetproperty("g_sStateOfOperation", "OK")
   RetVal = "FINISH"
end if

0 Likes
Highlighted
Absent Member.. sreedevireddy Absent Member..
Absent Member..

Re: error in wizard code

I have moved the whole Start.Do to Start.To . this is working for status = "Current".when I am selecting status ="Draft" I am getting error.

in "Finish" section where can I modified code(In Finish section "Do" is there, when I am changing "To" instead of "Do" it is not accepting.I f I am using "DO" I am getting the attached error.

Please find the attached screen shot.

 

Could you please suggest.

0 Likes
Acclaimed Contributor.. Mark Cullen_1 Acclaimed Contributor..
Acclaimed Contributor..

Re: error in wizard code

Remove "FINISH" from the Start.To and just use double quotes (RetVal = "").  If this doesn't work then you will need another page where the end user will select the FINISH button.

 

 

There is no FINISH.To only the FINISH.Do.  For a better understanding of wizard nodes I suggest reviewing WIZARDS chapter in the AdvancedUse pdf guide (Docs\pdf folder of default installation).

 

"Draft" is not working due to AND condition; change to OR condition because your variable cannot be different values at the same time.

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.