ну вот вам пример из зарплаты
 
Код: Выделить всё
 #declare Pick_Deb (TableName, SchetField, SubschField, KAUField)
  begin
      if (CurField = #SchetField) or (CurField = #SubschField)
      {
        if (CurCommand = cmOpenSearch)
          QuickChoiceName := if (CurField = #SchetField, 'qcBuh_SchetAndSub', 'qcBuh_SubSchet');
        else
          QuickChoiceName := '';
        shpzar := PLANSSCH.KOD + #TableName.CSCHETD;
        if (RunInterface('GetBuhSchet', word(cgiPick), MyPlansNo, shpzar, #TableName.CSUBSCHD) <> cmCancel)
        {
          #TableName.cSchetD  := SubStr(shpzar, 2, cgSchetLength-1);
          var SA: StickyAnalytics;
          SA.Stick(shpzar, #TableName.CSUBSCHD, #TableName.TBLD, #TableName.CKAUD);
          set #TableName.cSchetD := #TableName.CSCHETD;
        }
      }
      if (CurField = #KAUField)
      {
        shpzar := PlansSch.Kod + #TableName.cSchetD;
        if (iXGetKau.PickKauBuh(
          cgiPick, word(0),
          shpzar, #TableName.cSubSchD,#TableName.TBLD,#TableName.CKAUD))
          set #TableName.CKAUD[1] := #TableName.CKAUD[1];
      }
  end;
  #end //Pick_Deb
Использование 
  #Pick_Deb(LSchet, #SchetDeb, #SubSchDeb, #NamKaud);
где NamKaud - текстовое значение поля аналитики.
Код: Выделить всё
RTrim(if (GetAnyKau(cgAkSimple, OtpDop.TBLD[1], OtpDop.CKAUD[1]), GivenAnName(cgAnName), '') + '\' +
          if (GetAnyKau(cgAkSimple, OtpDop.TBLD[2], OtpDop.CKAUD[2]), GivenAnName(cgAnName), '') + '\' +
          if (GetAnyKau(cgAkSimple, OtpDop.TBLD[3], OtpDop.CKAUD[3]), GivenAnName(cgAnName), '') + '\' +
          if (GetAnyKau(cgAkSimple, OtpDop.TBLD[4], OtpDop.CKAUD[4]), GivenAnName(cgAnName), '') + '\' +
          if (GetAnyKau(cgAkSimple, OtpDop.TBLD[5], OtpDop.CKAUD[5]), GivenAnName(cgAnName), '') + '\' +
          if (GetAnyKau(cgAkSimple, OtpDop.TBLD[6], OtpDop.CKAUD[6]), GivenAnName(cgAnName), '') , '\'),