Custom Salesforce button for Docusign giving error - unexpected token~ - salesforce

I am creating a custom docusign button on our opportunities object in salesforce and after i crafted the code i am receiving an error message "Unexpected token ~". No clue what this means. I can only hope i have something slightly off on my code. Here is the code:
{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}
//********* Option Declarations (Do not modify )*********//
var RC = '';var RSL='';var RSRO='';var RROS='';var CCRM='';var CCTM='';var
CCNM='';var CRCL=''; var CRL='';var OCO='';var DST='';var LA='';var CEM='';var
CES='';var STB='';var SSB='';var SES='';var SEM='';var SRS='';var SCS ='';var
RES='';
//*************************************************//
// Modify individual options here://
// Recipient Starting Routing Order (default 1)//
RSRO = '1';
// Recipient Routing Order Sequential (default not sequential)//
RROS = '1';
// Custom Recipient List//
CRL = 'Email~anthony.m#playmakercrm.com;FirstName~Anthony;LastName~Miranda;Role~Signer 1;RoutingOrder~1;SignNow~1',
Email~;FirstName~;LastName~;Role~Signer 2;RoutingOrder~2;SignNow~1,
Email~john.g#playmakercrm.com;FirstName~John;LastName~Griscavage;Role~Signer 3;RoutingOrder~3;SignNow~0,
Email~anthony.m#playmakercrm.com;FirstName~Anthony;LastName~Miranda;Role~Signer 4;RoutingOrder3~;SignNow~,
Email~adam.bishop#playmakercrm.com;FirstName~Adam;LastName~Bishop;Role~Signer 5;RoutingOrder~3;SignNow~0,
Email~accounting#playmakercrm.com;FirstName~Accounting;LastName~Department;Role~Signer 6;RoutingOrder~3;SignNow~0,
Email~{!Opportunity.OwnerEmail};FirstName~{!Opportunity.OwnerFirstName};LastName~{!Opportunity.OwnerLastName};Role~Signer 7;RoutingOrder~3;SignNow~0,
Email~laura.mcdavid#playmakercrm.com;FirstName~Laura;LastName~McDavid;Role~Signer 8;RoutingOrder~3;SignNow~0;
// One Click Option (default edit envelope screen)//
OCO = 'Tag';
// Load Attachments (default on)//
LA = '1';
// Show Tag Button (default in config)//
STB = '1';
// Show Send Button (default in config)//
SSB = '1';
// Show Email Subject (default in config)//
SES = '1';
// Show Email Message (default in config)//
SEM = '1';
// Show Reminder/Expire (default in config)//
SRS = '1';
//********* Page Callout (Do not modify) *********//
window.location.href =
"/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Opportunity.Id}&RC="+RC+"&RSL="+RSL+"&RSRO="+RSRO+"&RROS="+RROS+"&CCRM="+CCRM+"&CCTM="+CCTM+"&CRCL="+CRC
L+"&CRL="+CRL+"&OCO="+OCO+"&DST="+DST+"&CCNM="+CCNM+"&LA="+LA+"&CEM="+CEM+"&CES=
"+CES+"&SRS="+SRS+"&STB="+STB+"&SSB="+SSB+"&SES="+SES+"&SEM="+SEM+"&SRS="+SRS+"&
SCS="+SCS+"&RES="+RES;
//*******************************************//
I appreciate any help someone can provide me here.
UPDATED CODE (Removed line breaks)
{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}
//********* Option Declarations (Do not modify )*********//
var RC = '';var RSL='';var RSRO='';var RROS='';var CCRM='';var CCTM='';var
CCNM='';var CRCL=''; var CRL='';var OCO='';var DST='';var LA='';var CEM='';var
CES='';var STB='';var SSB='';var SES='';var SEM='';var SRS='';var SCS ='';var
RES='';
//*************************************************//
// Modify individual options here://
RSRO = '1';RROS = '1';CRL = 'Email~anthony.m#playmakercrm.com;FirstName~Anthony;LastName~Miranda;Role~Signer 1;RoutingOrder~1;SignNow~1',Email~;FirstName~;LastName~;Role~Signer 2;RoutingOrder~2;SignNow~1,Email~john.g#playmakercrm.com;FirstName~John;LastName~Griscavage;Role~Signer 3;RoutingOrder~3;SignNow~0,Email~anthony.m#playmakercrm.com;FirstName~Anthony;LastName~Miranda;Role~Signer 4;RoutingOrder3~;SignNow~,Email~adam.bishop#playmakercrm.com;FirstName~Adam;LastName~Bishop;Role~Signer 5;RoutingOrder~3;SignNow~0,Email~accounting#playmakercrm.com;FirstName~Accounting;LastName~Department;Role~Signer 6;RoutingOrder~3;SignNow~0,Email~{!Opportunity.OwnerEmail};FirstName~{!Opportunity.OwnerFirstName};LastName~{!Opportunity.OwnerLastName};Role~Signer 7;RoutingOrder~3;SignNow~0,
Email~laura.mcdavid#playmakercrm.com;FirstName~Laura;LastName~McDavid;Role~Signer 8;RoutingOrder~3;SignNow~0;OCO = 'Tag';LA = '1';STB = '1';SSB = '1';SES = '1';SEM = '1';SRS = '1';
//********* Page Callout (Do not modify) *********//
window.location.href =
"/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Opportunity.Id}&RC="+RC+"&RSL="+RSL+"&RSRO="+RSRO+"&RROS="+RROS+"&CCRM="+CCRM+"&CCTM="+CCTM+"&CRCL="+CRC
L+"&CRL="+CRL+"&OCO="+OCO+"&DST="+DST+"&CCNM="+CCNM+"&LA="+LA+"&CEM="+CEM+"&CES=
"+CES+"&SRS="+SRS+"&STB="+STB+"&SSB="+SSB+"&SES="+SES+"&SEM="+SEM+"&SRS="+SRS+"&
SCS="+SCS+"&RES="+RES;
//*******************************************//
I have done just as Larry K suggested below and have updated the code. Now, the error message does not show up when i click the button. Nothing happens at all. It's almost like it is not firing.
{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}
//********* Option Declarations (Do not modify )*********//var RC = '';var RSL='';var RSRO='';var RROS='';var CCRM='';var CCTM='';varCCNM='';var CRCL=''; var CRL='';var OCO='';var DST='';var LA='';var CEM='';varCES='';var STB='';varSSB='';var SES='';var SEM='';var SRS='';var SCS ='';varRES='';//*************************************************//
// Modify individual options here://RSRO = '1';RROS = '1';CRL = 'Email~anthony.m#playmakercrm.com;FirstName~Anthony;LastName~Miranda;Role~Signer 1;RoutingOrder~1;SignNow~1,Email~client#domain.com;FirstName~Client;LastName~Name;Role~Signer 2;RoutingOrder~2;SignNow~1,Email~john.g#playmakercrm.com;FirstName~John;LastName~Griscavage;Role~Signer 3;RoutingOrder~3;SignNow~0,Email~anthony.m#playmakercrm.com;FirstName~Anthony;LastName~Miranda;Role~Signer 4;RoutingOrder3~;SignNow~0,Email~adam.bishop#playmakercrm.com;FirstName~Adam;LastName~Bishop;Role~Signer 5;RoutingOrder~3;SignNow~0,Email~accounting#playmakercrm.com;FirstName~Accounting;LastName~Department;Role~Signer 6;RoutingOrder~3;SignNow~0,Email~{!Opportunity.OwnerEmail};FirstName~{!Opportunity.OwnerFirstName};LastName~{!Opportunity.OwnerLastName};Role~Signer 7;RoutingOrder~3;SignNow~0,Email~laura.mcdavid#playmakercrm.com;FirstName~Laura;LastName~McDavid;Role~Signer 8;RoutingOrder~3;SignNow~0'; OCO = 'Tag';LA = '1';STB = '1';SSB = '1';SES = '1';SEM = '1';SRS = '1';
//********* Page Callout (Do not modify) *********//window.location.href ="/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Opportunity.Id}&RC="+RC+"&RSL="+RSL+"&RSRO="+RSRO+"&RROS="+RROS+"&CCRM="+CCRM+"&CCTM="+CCTM+"&CRCL="+CRCL+"&CRL="+CRL+"&OCO="+OCO+"&DST="+DST+"&CCNM="+CCNM+"&LA="+LA+"&CEM="+CEM+"&CES="+CES+"&SRS="+SRS+"&STB="+STB+"&SSB="+SSB+"&SES="+SES+"&SEM="+SEM+"&SRS="+SRS+"&SCS="+SCS+"&RES="+RES;
//*******************************************//
UPDATED CODE YET AGAIN. Removed all recipients except one from the Custom Recipeint List. Button still does not fire. It does nothing. could it be something else i am missing in salesforce?
Here is the updated code with only one recipient:
{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}
//********* Option Declarations (Do not modify )*********//var RC = '';var RSL='';var RSRO='';var RROS='';var CCRM='';var CCTM='';varCCNM='';var CRCL=''; var CRL='';var OCO='';var DST='';var LA='';var CEM='';varCES='';var STB='';varSSB='';var SES='';var SEM='';var SRS='';var SCS ='';varRES='';//*************************************************//
// Modify individual options here://RSRO = '1';RROS = '1';CRL = 'Email~anthony.m#playmakercrm.com;FirstName~Anthony;LastName~Miranda;Role~Signer 1;RoutingOrder~1;SignNow~1'; OCO = 'Tag';LA = '1';STB = '1';SSB = '1';SES = '1';SEM = '1';SRS = '1';
//********* Page Callout (Do not modify) *********//window.location.href ="/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Opportunity.Id}&RC="+RC+"&RSL="+RSL+"&RSRO="+RSRO+"&RROS="+RROS+"&CCRM="+CCRM+"&CCTM="+CCTM+"&CRCL="+CRCL+"&CRL="+CRL+"&OCO="+OCO+"&DST="+DST+"&CCNM="+CCNM+"&LA="+LA+"&CEM="+CEM+"&CES="+CES+"&SRS="+SRS+"&STB="+STB+"&SSB="+SSB+"&SES="+SES+"&SEM="+SEM+"&SRS="+SRS+"&SCS="+SCS+"&RES="+RES;
//*******************************************//

Looks like your page callouts had linebreaks (if copied direct from the DocuSign documentation they would). Try putting the variables between this:
{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}
//********* Option Declarations (Do not modify )*********// var RC =
'';var RSL='';var RSRO='';var RROS='';var CCRM='';var CCTM='';var
CCNM='';var CRCL=''; var CRL='';var OCO='';var DST='';var LA='';var
CEM='';var CES='';var STB='';var SSB='';var SES='';var SEM='';var
SRS='';var SCS ='';var RES='';
//*************************************************//
// Modify individual options here://
//********* Page Callout (Do not modify) *********//
window.location.href =
"/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Opportunity.Id}&RC="+RC+"&RSL="+RSL+"&RSRO="+RSRO+"&RROS="+RROS+"&CCRM="+CCRM+"&CCTM="+CCTM+"&CRCL="+CRCL+"&CRL="+CRL+"&OCO="+OCO+"&DST="+DST+"&CCNM="+CCNM+"&LA="+LA+"&CEM="+CEM+"&CES="+CES+"&SRS="+SRS+"&STB="+STB+"&SSB="+SSB+"&SES="+SES+"&SEM="+SEM+"&SRS="+SRS+"&SCS="+SCS+"&RES="+RES;
//*******************************************//

The documentation for creating custom buttons shows that the CRL takes a string parameter. However, your CRL value is not valid because:
You prematurely close the string after the Signer 1 person
You have empty CRL information after the Signer 1 person
You still have a hard return after the signer 7 person
You don't close the string after the last person.
You're missing a value for SignNow for signer 5
Also, it may be an issue that you're using an email alias for the accounting group. It would probably be better to use DocuSign Signing Groups. I don't know if that feature is supported in the Salesforce integration yet or not.
To debug, first add a return after each comma in the CRL value and check that each line (each recipient) is complete:
RSRO = '1';RROS = '1';CRL = '
Email~anthony.m#playmakercrm.com;FirstName~Anthony;LastName~Miranda;Role~Signer 1;RoutingOrder~1;SignNow~1,
Email~john.g#playmakercrm.com;FirstName~John;LastName~Griscavage;Role~Signer 3;RoutingOrder~3;SignNow~0,
Email~anthony.m#playmakercrm.com;FirstName~Anthony;LastName~Miranda;Role~Signer 4;RoutingOrder3~;SignNow~0,
Email~adam.bishop#playmakercrm.com;FirstName~Adam;LastName~Bishop;Role~Signer 5;RoutingOrder~3;SignNow~0,
Email~accounting#playmakercrm.com;FirstName~Accounting;LastName~Department;Role~Signer 6;RoutingOrder~3;SignNow~0,
Email~{!Opportunity.OwnerEmail};FirstName~{!Opportunity.OwnerFirstName};LastName~{!Opportunity.OwnerLastName};Role~Signer 7;RoutingOrder~3;SignNow~0,
Email~laura.mcdavid#playmakercrm.com;FirstName~Laura;LastName~McDavid;Role~Signer 8;RoutingOrder~3;SignNow~0
';
OCO = 'Tag';LA = '1';STB = '1';SSB = '1';SES = '1';SEM = '1';SRS = '1';
(Note the apostrophe at the start and end of the CRL value)
Next, remove the returns from the CRL value and hopefully it will work for you:
RSRO = '1';RROS = '1';CRL = 'Email~anthony.m#playmakercrm.com;FirstName~Anthony;LastName~Miranda;Role~Signer 1;RoutingOrder~1;SignNow~1,Email~john.g#playmakercrm.com;FirstName~John;LastName~Griscavage;Role~Signer 3;RoutingOrder~3;SignNow~0,Email~anthony.m#playmakercrm.com;FirstName~Anthony;LastName~Miranda;Role~Signer 4;RoutingOrder3~;SignNow~0,Email~adam.bishop#playmakercrm.com;FirstName~Adam;LastName~Bishop;Role~Signer 5;RoutingOrder~3;SignNow~0,Email~accounting#playmakercrm.com;FirstName~Accounting;LastName~Department;Role~Signer 6;RoutingOrder~3;SignNow~0,Email~{!Opportunity.OwnerEmail};FirstName~{!Opportunity.OwnerFirstName};LastName~{!Opportunity.OwnerLastName};Role~Signer 7;RoutingOrder~3;SignNow~0,Email~laura.mcdavid#playmakercrm.com;FirstName~Laura;LastName~McDavid;Role~Signer 8;RoutingOrder~3;SignNow~0'; OCO = 'Tag';LA = '1';STB = '1';SSB = '1';SES = '1';SEM = '1';SRS = '1';

Related

Instagram browser does not handle ICS links

I have a link to the ICS calendar: See here
Every browser handles it properly (download file on Desktop and open Calendar app on iPhone), except Instagram in-app browser - when you open this link in Instagram (like from Direct Messages), it just shows file content.
How do I force the Instagram app to open Calendar app for this type of links?
Here is part of PHP code I use to generate this file:
$calendar_string = [];
$calendar_string[] = "BEGIN:VCALENDAR\n";
$calendar_string[] = "VERSION:2.0\n";
$calendar_string[] = "PRODID:-//Veronika Agafonova//NONSGML Veronika Agafonova//EN\n";
$calendar_string[] = "METHOD:REQUEST\n"; // requied by Outlook
$calendar_string[] = "BEGIN:VEVENT\n";
$calendar_string[] = "UID:".date('Ymd').'T'.date('His')."-".rand()."-example.com\n"; // required by Outlok
$calendar_string[] = "DTSTAMP:".date('Ymd').'T'.date('His')."\n"; // required by Outlook
$calendar_string[] = "DTSTART:$date_start\n";
$calendar_string[] = "DTEND:$date_end\n";
$calendar_string[] = "SUMMARY:$title\n";
$calendar_string[] = "DESCRIPTION:$details\n";
$calendar_string[] = "END:VEVENT\n";
$calendar_string[] = "END:VCALENDAR\n";
header("Content-Type: text/Calendar");
header("Content-Disposition: attachment; filename=calendar.ics");
header("Content-Length: ". strlen(implode("", $calendar_string)).";");
header("Content-Type: application/force-download");
header("Content-Transfer-Encoding: binary");
header("Connection: close");
echo implode("", $calendar_string);

Unable to connect to your database server using the provided settings in CI

A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: /home/rehmantr/public_html/third_party/MX/Loader.php
Line Number: 94
Dear Sir,
I am facing this issue, my database.php file setting is below
$active_group = 'default';
$active_record = TRUE;
$db['default']['hostname'] = 'hostname';
$db['default']['username'] = 'username';
$db['default']['password'] = 'password';
$db['default']['database'] = 'database';
$db['default']['dbdriver'] = 'mysqli';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = FALSE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
but still I am facing this issue,please help me.
I am using HMVC pattern of CI
I think its a problem with your credentials, verify that user and password are correct and that the user has access to the database you specify in the settings.

Docusign for Salesforce CRCL not populating

I have a Docusign Send Now button with the following code:
{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}
//********* Option Declarations (Do not modify )*********//
var RC = '';
var RSL='';
var RSRO='';
var RROS='';
var CCRM='';
var CCTM='';
var CCNM='';
var CRCL='';
var CRL='';
var OCO='';
var DST='';
var LA='';
var CEM='';
var CES='';
var STB='';
var SSB='';
var SES='';
var SEM='';
var SRS='';
var SCS='';
var RES='';
//*************************************************//
// Modify individual options here:
LA = '1';
DST = '';
RC = '';
RSL = '';
RSRO = '';
RROS = '0';
CCRM = 'Deal Signer~Signer;Invoice Contact~Carbon Copy';
CCTM = 'Signer1~Signer;Carbon Copy~CC';
CCNM = '';
CRCL = 'Deal_Contacts__r,Email~Email__c;LastName~Name;Role~Contact_Deal_Role__c;SignNow~Contact_Sign_Now__c;LoadDefaultContacts~0';
CRL = '';
CEM = ''; //TODO: Set this as a field on the document.
CES = ''; //TODO: Set this as a field on the document.
STB = '0';
SSB = '0';
SES = '0';
SEM = '0';
SRS = '0';
SCS = '0';
RES = '1,3,3,1,10,1';
OCO = 'Tag';
//********* Page Callout (Do not modify) *********//
window.location.href ="/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Deal__c.Id}&RC="+RC+"&RSL="+RSL+"&RSRO="+RSRO+"&RROS="+RROS+"&CCRM="+CCRM+"&CCTM="+CCTM+"&CRCL="+CRCL+"&CRL="+CRL
+"&OCO="+OCO+"&DST="+DST+"&CCNM="+CCNM+"&LA="+LA+"&CEM="+CEM+"&CES="+CES+"&SRS="+SRS+"&STB="+STB+"&SSB="+SSB+"&SES="+SES+"&SEM="+SEM+"&SRS="+SRS+"&SCS="+SCS+"&RES="+RES;
//*******************************************//
However, when I click the button, the TO fields do not populate. I have setup a custome object on my Deal__c object and everything pulls correctly when I query. Anyone have a similar issue or example code? Thanks!
EDIT: I was able to achieve the desired result with this code:
{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")}
var RC = '';var RSL='';var RSRO='';var RROS='';var CCRM='';var CCTM='';var CCNM='';var CRCL=''; var CRL='';var OCO='';var DST='';var LA='';var CEM='';var CES='';var STB='';var SSB='';var SES='';var SEM='';var SRS='';var SCS='';var RES='';
var deal = "{!Deal__c.Id}";
var dealContacts = sforce.apex.execute("GetDealContacts","getDealContacts",{dealID: deal});
if(!dealContacts.length) {
alert("This Customer Account has no Deal Signers. Please add a Deal Signer to continue.");
return;
}
var contacts = [];
var number;
for ( var i = 0, l = dealContacts.length; i < l; i++ ) {
var role = "";
number = i + 1
if(dealContacts[i].Role__c === "Deal Signer"){
role = "Signer" + number.toString();
} else {
role = "Invoice Contact";
}
contacts.push("Email~" + dealContacts[i].Email__c + ";Role~" + role + ";LastName~" + dealContacts[i].Name + ";SignNow~0");
}
var contactString = contacts.join(",");
contactString += ", LoadDefaultContacts~0";
LA = '1';
RSL = number;
CRL = contactString;
CCTM = 'Invoice Contact~Carbon Copy';
STB = '0';
SSB = '0';
SES = '0';
SEM = '0';
SRS = '0';
SCS = '0';
RES = '1,3,3,1,10,1';
OCO = 'Send';
//********* Page Callout (Do not modify) *********//
window.location.href = "/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Deal__c.Id}&RC="+RC+"&RSL="+RSL+"&RSRO="+RSRO+"&RROS="+RROS+"&CCRM="+CCRM+"&CCTM="+CCTM+"&CRCL="+CRCL+"&CRL="+CRL+"&OCO="+OCO+"&DST="+DST+"&CCNM="+CCNM+"&LA="+LA+"&CEM="+CEM+"&CES="+CES+"&SRS="+SRS+"&STB="+STB+"&SSB="+SSB+"&SES="+SES+"&SEM="+SEM+"&SRS="+SRS+"&SCS="+SCS+"&RES="+RES;
//*******************************************//
Answered above in EDIT. Please see the second code block.

How do query (where,inner join) with Alloy (appcelerator)?

I'm working on:
Application Mobile with Alloy
Titanium SDK version: 2.1.3 (10/02/12 16:16 15997d0)
iPhone Device family: universal
iPhone SDK version: 6.0
iPhone simulated device: iphone
Detected compiler plugin: ti.alloy/1.0
I've created two models:
alloy generate model met sql met_id:int libelle:string famille_id:int
alloy generate model famille sql famille_id:int libelle:string
And filled the following data:
var mets = Alloy.createCollection('Met')
var met = Alloy.createModel("Met",{met_id:1,libelle:"Salade de Chèvre Chaud",famille_id:1});mets.add(met);met.save();
var met = Alloy.createModel("Met",{met_id:2,libelle:"Salade de Chèvre Chaud",famille_id:2});mets.add(met);met.save();
var met = Alloy.createModel("Met",{met_id:3,libelle:"Salade de Chèvre Chaud",famille_id:3});mets.add(met);met.save();
var met = Alloy.createModel("Met",{met_id:4,libelle:"Salade de Chèvre Chaud",famille_id:4});mets.add(met);met.save();
var met = Alloy.createModel("Met",{met_id:5,libelle:"Salade de Chèvre Chaud",famille_id:1});mets.add(met);met.save();
var met = Alloy.createModel("Met",{met_id:6,libelle:"Salade de Chèvre Chaud",famille_id:2});mets.add(met);met.save();
var met = Alloy.createModel("Met",{met_id:7,libelle:"Salade de Chèvre Chaud",famille_id:3});mets.add(met);met.save();
var met = Alloy.createModel("Met",{met_id:8,libelle:"Salade de Chèvre Chaud",famille_id:4});mets.add(met);met.save();
var met = Alloy.createModel("Met",{met_id:9,libelle:"Salade de Chèvre Chaud",famille_id:1});mets.add(met);met.save();
var familles = Alloy.createCollection('Famille')
var famille = Alloy.createModel("Met",{famille_id:1,libelle:"famille 1");familles.add(famille);famille.save();
var famille = Alloy.createModel("Met",{famille_id:2,libelle:"famille 2"});familles.add(famille);famille.save();
var famille = Alloy.createModel("Met",{famille_id:3,libelle:"famille 3"});familles.add(famille);famille.save();
var famille = Alloy.createModel("Met",{famille_id:4,libelle:"famille 4"});familles.add(famille);famille.save();
Now, I would like fetch all "met" with famille_id = 1.
var mets = Alloy.createCollection('Met')
mets.where({famille_id:1}).
My first problem is that mets.length = 0. Anybody know why?
Second one is how can I make an inner join between met and famille_id?
For information, if I do:
var mets = Alloy.createCollection('Met')
mets.fetch();
for(var i = 0;i< mets.length;i++)
{
var args = {
plat : mets.models[i].attributes.libelle,
met_id : mets.models[i].attributes.met_id
}
var rowPlat = Alloy.createController('rowPlat', args).getView();
data.push(rowPlat);
}
I have all data in a tableView, and it works fine.
Your problem is that you have not fetched any data. So where will return no record.
So first initialize your collection :
var mets = Alloy.createCollection('Met')
mets.fetch();
Then when needed, filter your data based on your input.
mets.where({famille_id:1})
As I do not use Alloy I have not tested this. But Alloy.createCollection just return a Backbone.Collection s

CodeIgniter 2.1.2 and MS SQL on PHP 5.3.13

I have been at this one all night and our offices open in 69 minutes.
Our server was just updated to PHP 5.3.13 and a critical online application that connects to MS SQL 2008 is just producing a blank page - no errors being logged, just snow. It is written in CodeIgniter 2.1.2.
If I do not autoload ( or try to connect to the db ), the page displays the static elements. Once I add the database.php config file, it's a white-out.
I am trying the mssql and the sqldrv drivers and getting the same results.
I am hoping to find some ideas on how I can go about debugging this solution in an ASAP sort-of-way.
My offending config (which worked until the upgrade) in the database.php looks like this:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$active_group = "default";
$active_record = TRUE;
$db['default']['hostname'] = "<<SQL SRV NAME>>";
$db['default']['username'] = "<<USERNAME>>";
$db['default']['password'] = "<<PASSWORD>>";
$db['default']['database'] = "<<DATABASE NAME>>";
$db['default']['dbdriver'] = "mssql";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";
ANY thoughts are GREATLY appreciated.
A bit late now I suspect, but the current version of CodeIgniter (2.1.2) has the following in its Database config file by default:
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'username';
$db['default']['password'] = 'password';
$db['default']['database'] = 'database';
$db['default']['dbdriver'] = 'mssql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
Note the extra couple of configs there at the end. It may be looking for them but as they're not supplied it's erroring...

Resources