Advertisement
Guest User

Untitled

a guest
Jul 13th, 2018
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.71 KB | None | 0 0
  1. function ifQExistsCheckCat(Question,loopCat,innerQ,cat,IOM)
  2.  
  3. '------------------------------------
  4. 'Version: 01
  5. 'Last modified on: 13/07/2018
  6. 'Last modified by: Denislav.Angelov@ipsos.com
  7. '------------------------------------
  8. 'Description:
  9. 'This function is designed to check:
  10. ' - If the desired question exists.
  11. ' - If certain categories exists for this question.
  12. ' - If certain answer is selected in the desired question.
  13. '------------------------------------
  14.  
  15. ifQExistsCheckCat = false
  16.  
  17. Question = cText(Question)
  18.  
  19. 'Check if question exists. If it doesn't exists print message in Output.
  20. if not(isnullObject(FindItem(IOM.Questions,Question))) then
  21.    
  22.     'Check question type.
  23.     select case Question.QuestionDataType
  24.    
  25.         case 0 '<-- Loop
  26.            
  27.             'Check if the seleceted categorie (loopCat) exists on this question.
  28.             If not(isnullObject(FindItem(IOM.Questions,Question + "[" + cText(loopCat)+ "]" ))) then
  29.            
  30.                 'Checks if the question contains a certain answer (cat).
  31.                 if cat then
  32.                     if IOM.Questions[Question + "[" + cText(loopCat) + "]" ].Item[innerQ] * ccategorical(cat) then
  33.                         ifQExistsCheckCat = true
  34.                         exit function
  35.                     end if
  36.                 else
  37.                     ifQExistsCheckCat = true
  38.                     exit function
  39.                 end if
  40.             End If
  41.            
  42.         case 1 to 3 '<-- Categorical,Text,Long
  43.        
  44.                 if cat then
  45.                     'Checks if the question contains a certain answer (cat).
  46.                     if Question * cat then
  47.                         ifQExistsCheckCat = true
  48.                         exit function
  49.                     end if
  50.                 else
  51.                     ifQExistsCheckCat = true
  52.                     exit function
  53.                 end if
  54.            
  55.         case else
  56.        
  57.             debug.MsgBox("Invalid question type.")
  58.            
  59.     end select
  60. else
  61.     debug.Log(Question+" : the question does not exist in metadata")
  62. end if
  63.  
  64. end function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement