Sayfayı Yazdır | Pencereyi Kapat

Pos fonksiyonu sonucu if e girmiyor.

Nereden Yazdırıldığı: Clomosy | Forum
Kategori: Genel Programlama
Forum Adı: Genel İşlemler
Forum Tanımlaması: TRObject dili ile programlama yaparken karşılaşılan genel işlemler
URL: https://forum.clomosy.com.tr/forum_posts.asp?TID=965
Tarih: 04 Ocak 2025 Saat 11:58
Program Versiyonu: Web Wiz Forums 12.07 - https://www.webwizforums.com


Konu: Pos fonksiyonu sonucu if e girmiyor.
Mesajı Yazan: ElifKarabacak
Konu: Pos fonksiyonu sonucu if e girmiyor.
Mesaj Tarihi: 21 Kasım 2024 Saat 15:44
Aşağıdaki kodda 'idgridac' fonksiyonunda  Pos ile '{ ' karakterini ana stringde bulamadığı zaman aşağıdaki if e girmesi lazım ama girmiyor. Yardımcı olabilir misiniz?
" if (Position <= 0) "

var 
jsonObject:TClJsonQuery;
clRest:TclRest;
mainform: TclForm;
progrid: TclProGrid;
mainvertScrollBox: TCLVertScrollBox;
idstr:String;
firstName:String;
FSenderId:TCLProGrid;
FRowId, FColId : Integer;
mainform2:TclForm;
mainvertScrollBox2:TCLVertScrollBox;
jsonObject2:TClJsonQuery;
progrid2:TCLProGrid;
Position: Integer;
void idgridac;
{

  FSenderId = TCLProGrid(mainform.ClSender);
  FRowId = mainform.ClSenderRow; // 1 den başlıyor satırlar
  FColId = mainform.ClSenderCol; //0 dan başlıyor sütunlar
  ShowMessage('['+IntToStr(FRowId)+','+IntToStr(FColId)+'] '+'Hücresinde Bulunan Veri: '+FSenderId.Cells[FColId,FRowId]);
  mainform2 = TclForm.Create(self);
  ClRTSetProperty(mainform2,'ClientWidth',900);
  ClRTSetProperty(mainform2,'ClientHeight',750);
  
  mainvertScrollBox2 = mainform2.AddNewVertScrollBox(mainform2,'mainvertScrollBox2');
  mainvertScrollBox2.align=alClient;
  try

    jsonObject2 = Clomosy.ClDataSetFromJSON(FSenderId.Cells[FColId,FRowId]); 
    jsonObject2.openorexecute;
ShowMessage(FSenderId.Cells[FColId,FRowId]);
    with jsonObject2 do
    {
    
      
      if (Found) 
      {
        First; 
        while (not EOF)  
        {      
        Position = Pos('{', FSenderId.Cells[FColId,FRowId]);
 
   if (Position >= 0)
   { 
     ShowMessage('Substring not found.');
   }  
     else
      {
      ShowMessage('Substring found. Position: ' + IntToStr(Position));
     
       progrid2 = mainform2.addnewprogrid(mainvertScrollBox2, 'progrid2');
               progrid2.AutoSizeColumns(True,300);
               ProGrid2.ConnectDataSet(jsonObject2);
                 with progrid2 do
                  {
                    align= alClient;
                    margins.right= 30;
                    margins.left= 30;
                    margins.bottom= 30;
                    // width=(mainform.clwidth*90)/100;
                    //height=(mainform.clheight*75)/100;
                    FixedLayoutFillColor = clalphacolor.clhextocolor('#3fc660');
                  }
            ShowMessage(FieldByName('address').AsString);    
        //    mainform2.AddNewEvent(progrid2, tbeOnProGridCellClick,'idgridac2');
        
      }
             
          Next; 
        }
        
      }
      }
       except
 ShowMessage('Exception Class2: '+LastExceptionClassName+' Exception Message: '+LastExceptionMessage);
    }
  mainform2.run;
}
 void usersgrid;
 {

  clRest         = TclRest.Create;
  jsonObject     = TClJsonQuery.Create(nil);
  clRest.BaseURl = ' https://dummyjson.com/users/1" rel="nofollow - https://dummyjson.com/users/1 ';
  clRest.Accept  = 'application/json';
  clRest.Method  = rmGet;
  clRest.Execute;
 
   ShowMessage(clRest.Response);

   try

    jsonObject = Clomosy.ClDataSetFromJSON(clRest.Response); 
    jsonObject.openorexecute;

    with jsonObject do
    {
    
      
      if (Found) 
      {
        First; 
        while (not EOF)  
        {
               progrid = mainform.addnewprogrid(mainvertScrollBox, 'progrid');
               progrid.AutoSizeColumns(True,300);
               ProGrid.ConnectDataSet(jsonObject);
                 with progrid do
                  {
                    align= alClient;
                    margins.right= 30;
                    margins.left= 30;
                    margins.bottom= 30;
                    // width=(mainform.clwidth*90)/100;
                    //height=(mainform.clheight*75)/100;
                    FixedLayoutFillColor = clalphacolor.clhextocolor('#3fc660');
                  }
            ShowMessage(FieldByName('id').AsString);    
            mainform.AddNewEvent(progrid, tbeOnProGridCellClick,'idgridac');
          Next; 
        }
        
      }
      }
       except
 ShowMessage('Exception Class1: '+LastExceptionClassName+' Exception Message: '+LastExceptionMessage);
    }

}
{
  mainform = TclForm.Create(self);
  ClRTSetProperty(mainform,'ClientWidth',900);
  ClRTSetProperty(mainform,'ClientHeight',750);
  
  mainvertScrollBox = mainform.AddNewVertScrollBox(mainform,'mainvertScrollBox');
  mainvertScrollBox.align=alClient;
  

  usersgrid;  
  
  mainform.Run;
  
  
}




Cevaplar:
Mesajı Yazan: BilalCndn
Mesaj Tarihi: 21 Kasım 2024 Saat 17:18
Merhaba Elif,

Bu şekilde bir dener misin?
var 
jsonObject:TClJsonQuery;
clRest:TclRest;
mainform: TclForm;
progrid: TclProGrid;
mainvertScrollBox: TCLVertScrollBox;
idstr:String;
firstName:String;
FSenderId:TCLProGrid;
FRowId, FColId : Integer;
mainform2:TclForm;
mainvertScrollBox2:TCLVertScrollBox;
jsonObject2:TClJsonQuery;
progrid2:TCLProGrid;
Position: Integer;
a: string;
void idgridac;
{

  FSenderId = TCLProGrid(mainform.ClSender);
  FRowId = mainform.ClSenderRow; // 1 den başlıyor satırlar
  FColId = mainform.ClSenderCol; //0 dan başlıyor sütunlar
  ShowMessage('['+IntToStr(FRowId)+','+IntToStr(FColId)+'] '+'Hücresinde Bulunan Veri: '+FSenderId.Cells[FColId,FRowId]);
  mainform2 = TclForm.Create(self);
  ClRTSetProperty(mainform2,'ClientWidth',900);
  ClRTSetProperty(mainform2,'ClientHeight',750);
  
  mainvertScrollBox2 = mainform2.AddNewVertScrollBox(mainform2,'mainvertScrollBox2');
  mainvertScrollBox2.align=alClient;
  try
    jsonObject2 = Clomosy.ClDataSetFromJSON(FSenderId.Cells[FColId,FRowId]); 
    jsonObject2.openorexecute;
    a = FSenderId.Cells[FColId,FRowId];
    ShowMessage(a);
    Position = Pos('{', FSenderId.Cells[FColId,FRowId]);
    ShowMessage(Position)
    if (Position > 1)
    { 
      ShowMessage('Substring not found.');
    }  
    else
    {
      ShowMessage('Substring found. Position: ' + IntToStr(Position));
      progrid2 = mainform2.addnewprogrid(mainvertScrollBox2, 'progrid2');
      progrid2.AutoSizeColumns(True,300);
      ProGrid2.ConnectDataSet(jsonObject2);
      with progrid2 do
      {
        align= alClient;
        margins.right= 30;
        margins.left= 30;
        margins.bottom= 30;
        // width=(mainform.clwidth*90)/100;
        //height=(mainform.clheight*75)/100;
        FixedLayoutFillColor = clalphacolor.clhextocolor('#3fc660');
      }
      //mainform2.AddNewEvent(progrid2, tbeOnProGridCellClick,'idgridac2');
    }
  except
    ShowMessage('Exception Class2: '+LastExceptionClassName+' Exception Message: '+LastExceptionMessage);
  }
  mainform2.run;
}
 void usersgrid;
 {

  clRest         = TclRest.Create;
  jsonObject     = TClJsonQuery.Create(nil);
  clRest.BaseURl = ' https://dummyjson.com/users/1" rel="nofollow - https://dummyjson.com/users/1 ';
  clRest.Accept  = 'application/json';
  clRest.Method  = rmGet;
  clRest.Execute;
 
   ShowMessage(clRest.Response);

   try

    jsonObject = Clomosy.ClDataSetFromJSON(clRest.Response); 
    jsonObject.openorexecute;

    with jsonObject do
    {
    
      
      if (Found) 
      {
        First; 
        while (not EOF)  
        {
               progrid = mainform.addnewprogrid(mainvertScrollBox, 'progrid');
               progrid.AutoSizeColumns(True,300);
               ProGrid.ConnectDataSet(jsonObject);
                 with progrid do
                  {
                    align= alClient;
                    margins.right= 30;
                    margins.left= 30;
                    margins.bottom= 30;
                    // width=(mainform.clwidth*90)/100;
                    //height=(mainform.clheight*75)/100;
                    FixedLayoutFillColor = clalphacolor.clhextocolor('#3fc660');
                  }
            ShowMessage(FieldByName('id').AsString);    
            mainform.AddNewEvent(progrid, tbeOnProGridCellClick,'idgridac');
          Next; 
        }
        
      }
      }
       except
 ShowMessage('Exception Class1: '+LastExceptionClassName+' Exception Message: '+LastExceptionMessage);
    }

}
{
  mainform = TclForm.Create(self);
  ClRTSetProperty(mainform,'ClientWidth',900);
  ClRTSetProperty(mainform,'ClientHeight',750);
  
  mainvertScrollBox = mainform.AddNewVertScrollBox(mainform,'mainvertScrollBox');
  mainvertScrollBox.align=alClient;
  

  usersgrid;  
  
  mainform.Run;
  
  
}

İyi çalışmalar dilerim.


-------------
Bilal Candan

Atiker Yazılım Veri İşlem A.Ş.
Software Developer

[email protected]



Sayfayı Yazdır | Pencereyi Kapat

Forum Software by Web Wiz Forums® version 12.07 - https://www.webwizforums.com
Copyright ©2001-2024 Web Wiz Ltd. - https://www.webwiz.net