Display alert in case of no record found - Ireport

Asked

Viewed 95 times

0

How to make Ireport send only one alert in case of no record found?

Currently, is with a

}else{

echo "Nenhum dado encontrado!!!";

so I get a page like this, I would like to get just an alert, not open a page, it is possible?: inserir a descrição da imagem aqui

Below the full code:

/* begin page handling*/


                foreach ($this->arraydetail[$d] as $out) {
                    $this->currentrow=$this->arraysqltable[$this->global_pointer];

//                      echo $out["hidden_type"]."<br/>";
                    switch ($out["hidden_type"]) {
                        case "field":
                     //        $txt=$this->analyse_expression($compare["txt"]);
                       //  $out["txt"].":".print_r($out,true)."<br/>";
                 $maxheight=$this->detailallowtill-$checkpoint;//$this->arrayPageSetting["pageHeight"]-$this->arraypageFooter[0]["height"]-$this->pdf->GetY()+2-$this->columnheaderbandheight-$this->columnfooterbandheight;
                            $this->prepare_print_array=array("type"=>"MultiCell","width"=>$out["width"],"height"=>$out["height"],"txt"=>$out["txt"],
                                    "border"=>$out["border"],"align"=>$out["align"],"fill"=>$out["fill"],"hidden_type"=>$out["hidden_type"],
                                    "printWhenExpression"=>$out["printWhenExpression"],"soverflow"=>$out["soverflow"],"poverflow"=>$out["poverflow"],"link"=>$out["link"],
                                    "pattern"=>$out["pattern"],"writeHTML"=>$out["writeHTML"],"isPrintRepeatedValues"=>$out["isPrintRepeatedValues"],"valign"=>$out["valign"],
                                                                    "linktarget"=>$out['linktarget']);
                            $this->display($this->prepare_print_array,0,true,$maxheight);

              //                                  $checkpoint=$this->arraydetail[0]["y_axis"];

                            break;
                        case "relativebottomline":
                        //$this->relativebottomline($out,$tempY);
                            $this->relativebottomline($out,$biggestY);
                            break;
                          case "subreport":
                            $checkpoint=$this->display($out,$checkpoint);
                              //$this->arraydetail[0]["y_axis"]=$checkpoint;
                              //$biggestY=$checkpoint;
                              if($this->maxpagey['page_'.($this->pdf->getNumPages()-1)]<$checkpoint)
                              $this->maxpagey['page_'.($this->pdf->getNumPages()-1)]=$checkpoint;
                         break;
                        default:
                            //echo $out["hidden_type"]."=".print_r($out,true)."<br/><br/>";
                            $this->display($out,$checkpoint);
               $maxheight=$this->detailallowtill-$checkpoint;

                            //$checkpoint=$this->pdf->GetY();
                            break;
                    }

                    if($this->pdf->getNumPages()>1){

                    $this->pdf->setPage($currentpage);

                    }

                }
                //$this->pdf->lastPage();
                $checkpoint=$this->maxpagey['page_'.($this->pdf->getNumPages()-1)];


            }//end loop detail band[]
             $this->pdf->setPage($this->pdf->getNumPages());




                $this->global_pointer++;
                   $rownum++;           
                  $headerY=$checkpoint;      


            }


                    $this->global_pointer--;
        }else {

            echo "Nenhum dado encontrado!!!";


            // return ("http://facebook.com/");

            exit(0);

        }

2 answers

1


Miguel I believe it is so

    if(empty($nome1) or empty($nome2)){

  echo "<script>alert('Nenhum campo pode fica vazio.');top.location.href='index.php' ;</script>";

}

source

  • I don’t need to check if the field is empty, but the echo which put worked, the verification is done by the ireport itself, just needed the alert and return to the application, Thank you

0

I don’t think it’s that simple, but what comes to mind when you ask that is a simple

Alert('No data found!!!');

No? If not that (I doubt it is, honestly), you can explain better what you want to do?

  • I’ll add the full code

  • Mattheus Spoo, the alert works, but then opens a blank page

Browser other questions tagged

You are not signed in. Login or sign up in order to post.