TOPIC:

SQL-Casting for text-field 2 months 1 week ago #264241

  • Topic Author
  • Mister.Miracle
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 139
  • Karma: 1
  • Thanks: 1
Hello,

i created a form, where i want to cast one value.
fact: There are a lot of names and values
the value is entered be Breezingform. The valuedata should be a timesloot, between the start and the ende.the breezingform has entered, that this field should be a responsive calender

so i want to cast the value to the format date?
casting Problem: I created a sql-statement, which is given to an Joomla-Export.

hope you anderstand what i ment :-)

if i only check form "01.01.2021" there is a null response :-(

Please Log in or Create an account to join the conversation.

Last edit: Post by Mister.Miracle.

SQL-Casting for text-field 2 months 1 week ago #264246

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 7800
  • Karma: 3
  • Thanks: 550
Hi,

I am not sure I understood you well, sorry :(

In your form you have a responsive calendar for start and responsive calendar for end?
And then you want to show this is textfield

Regards,
Tihana

Please Log in or Create an account to join the conversation.

Last edit: Post by tihana.krivic.

SQL-Casting for text-field 2 months 1 week ago #264255

  • Topic Author
  • Mister.Miracle
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 139
  • Karma: 1
  • Thanks: 1
no i think i wrote a little bit misleading :-(

Yes, the breezing form has the element responsive calendar!
And this value will be saved in a database used by joomla.

now i have to code a php-programm that will be read this value out of database.
the problem is... the read-out value is a text string and not the type date.

And with this string value i have to make a switch / case oder if / then /else coding so that this read value has to be compared with some data (entered not by breezing form!) in this way

select * from facilesmile_subrecords where startdateBreezingform is between datevalueofanother1 and datevalueofanother2

now it is the fact:
  • the startdateBreezing is a string after i / php read it
  • datevalueofanother1 is date
  • datevalueofanother12 is date
the startdateBreezing is a string after i read it

so i cannot compare between string an date.

so i think i have to cast in the sql-statemen, but i dont know how to do it (on which position of code or another idea, how to create the possibilty to make compare posible)

hope you understand what i want to do and where i have the problem.

thank you for helping.

Please Log in or Create an account to join the conversation.

SQL-Casting for text-field 2 months 1 week ago #264257

  • Mirec's Avatar
  • Mirec
  • Away
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 1378
  • Karma: 2
  • Thanks: 76
HI,

okay, I will investigate your problem and make some test on my server. Please give me a little time for this and I will back to you as soon as possible!

If you have more questions feel free to ask!

Regards,
Mirko

Please Log in or Create an account to join the conversation.

SQL-Casting for text-field 2 months 1 week ago #264261

  • Mirec's Avatar
  • Mirec
  • Away
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 1378
  • Karma: 2
  • Thanks: 76
Hi,

I have one question,
when you said:

now i have to code a php-programm that will be read this value out of database.
the problem is... the read-out value is a text string and not the type date.


I guess that you want to get one value from the database of the element rep. calendar, is it the last sent value sent from rep. calendar, or?

this value?, which value you want to get from a database of re. calendat, the last stored the value of rep. calendar, or?

Regards,
Mirko

Please Log in or Create an account to join the conversation.

Last edit: Post by Mirec.

SQL-Casting for text-field 2 months 1 week ago #264308

  • Mirec's Avatar
  • Mirec
  • Away
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 1378
  • Karma: 2
  • Thanks: 76
Hi,

as I understand well you want to get all value between two elements of rep. calendar in the select list and then selected value from a select list you want to use for new compare.

I create one example for you, as is described in the above text.

You have a two-element rep. calendar and when you sent both, in the select list you will reived all data between that two rep. calendars.

Then value from a select list you can use for the next comparing.

Please download->unzip->and install it (BF->Configuration->Package Installer->select this xml file->Install Package).

Let me know is it ok for you, if you want we can modify my example and add some other things as you want.

I use a format, like this: '02-09-2021'

you can find code in Form pieces->Before Form:
$this->execPieceByName('ff_InitLib');

$db = JFactory::getDBO();

$db->setQuery('SELECT value FROM fkztj_facileforms_subrecords WHERE id=(SELECT max(id) FROM fkztj_facileforms_subrecords where name = "Calendar1" );');

$result = $db->loadResult();

$db->setQuery('SELECT value FROM fkztj_facileforms_subrecords WHERE id=(SELECT max(id) FROM fkztj_facileforms_subrecords where name = "Calendar2" );');

$result1 = $db->loadResult();

$format = 'm-d-Y';
 $array = array();
    $interval = new DateInterval('P1D');

    $realEnd = new DateTime($result1);
    $realEnd->add($interval);

    $period = new DatePeriod(new DateTime($result), $interval, $realEnd);

    foreach($period as $date) { 
        $array[] = $date->format($format); 
    }

$test = "";
for ($i = 0; $i < count($array); $i++)
{
     $test .= "0;".$array[$i].";".$array[$i]."\n";
}

function ff_setSelectList($name, $value)
{
     global $ff_processor;
     for ($r = 0; $r < $ff_processor->rowcount; $r++)
     {
          $row =& $ff_processor->rows[$r];
          if ($row->name==$name)
          $row->data2 = $value;
          unset($row);
     } // for
} // ff_setSelectList
ff_setSelectList('a', $test);

Regards,
Mirko
Attachments:

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Moderators: ForumSupport
Time to create page: 0.054 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!