I have built an Access Web App (2013) to keep track of device inventory for a client. They want to be able to mass-update the database using Excel spreadsheets that are generated from orders. I already know that there is no way to import/update data into an existing table in AWA, so I am attempting to build a data macro that will compare an imported table to the existing table, and add new records, or edit existing ones.
For right now, I am just trying to get the first part to work - add new records. However, no matter what I try, my data macro keeps giving me the error "Access can't convert the value of 'N/A' to the specified data type."
I have run a trace on the macro, and it shows that it goes through each step perfectly until the very end - it will create the new record, set the 2 fields I am testing with... and then try to create the record again. It gets stuck because it doesn't go back up to the next "For Each Record" loop for the imported table. I have tried doing a "Stop Macro" after the Create Record to see if I could get it to just do the first record, but it still tries to run again and fails.
I found on one page someone who said "Data Macros forbid the use of “CreateRecord cannot be used inside of a ForEachRecord”" but I haven't found anything to back that up anywhere.
I do not have enough reputation points to post images or even link to them, unfortunately, so I am going to try to accurately represent my macro and trace below (please excuse my relative newness to the site :( ).
My Macro looks as such:
For Each Record In ImportTest
Where Condition
SetLocalVar
Name IsMatch
Expression = 0
Look Up A Record In Inventory List
Where Condition = [InventoryList].[SerialNumber]=[ImportTest].[Serial Number]
SetLocalVar
Name IsMatch
Expression = 1
If [IsMatch]=0 Then
Create a Record In Inventory List
Set Field
Name InventoryList.BuildingName
Value = 1
Set Field
Name InventoryList.SerialNumber
Value = [ImportTest].[Serial Number]
End If
So to explain what my goal was, in case I did it wrong: The "For Each Record In ImportTest" is looking through the imported table (no where condition because I want all of them). The first "SetLocalVar IsMatch" is to give the macro a way to know if the serial number in the import table matches another record in the existing InventoryList table (this is where I would then update that record, once I get it all working). Next is my "If [IsMatch]=0" which checks to see if a matching record was ever found (would've been set to 1 if it had found the match before). Since no match is found, it creates a record in InventoryList using the current record that the For Each Record loop is pointed at. I actually have many other fields that will be set, but these two are just for my proof of concept (my InventoryList requires these two fields). At this point, it should finish adding the record, then hit the end of the loop, and start anew. However, my trace shows "CreateRecord" throwing an SQL exception:
MacroName-ActionName-Operand-Output-TargetRow-RuntimeErrorMessage
ImportMacro-ForEachRecord-ImportTest;---
ImportMacro-ForEachRecord---[ID] = 1 ; [Serial Number] = TESTTEST1 ; [Building Name] = Glendaal Elementary School-
ImportMacro-SetLocalVar-IsMatch-0.000000--
ImportMacro-LookupRecord-InventoryList;WHERE [InventoryList].[SerialNumber]=[ImportTest].[Serial Number]---
ImportMacro-If-[IsMatch]=0---
ImportMacro-CreateRecord----
ImportMacro-If-[ImportTest].[Building Name]="Glendaal Elementary School"---
ImportMacro-SetField-InventoryList.BuildingName-1--
ImportMacro-SetField-InventoryList.SerialNumber-TESTTEST1--
ImportMacro-CreateRecord----SQL exception
I can't figure out why it's doing this last "CreateRecord" that throws the exception. Does anyone see what I may have missed, or have suggestions for how to proceed?
Thanks in advance to all who help.
~SetsunaMH
Current version of ImportTest data macro:
<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<DataMacros xmlns="http://schemas.microsoft.com/office/accessservices/2010/12/application"><DataMacro><Statements><ForEachRecord><Data><Reference>ImportTest</Reference></Data><Statements><Action Name="SetLocalVar"><Argument Name="Name">IsMatch</Argument><ExpressionArgument Name="Value"><Expression><Original>0</Original><IntegerLiteral Value="0"/></Expression></ExpressionArgument></Action><LookUpRecord><Data><Reference>InventoryList</Reference><WhereCondition><Expression><Original>[InventoryList].[SerialNumber]=[ImportTest].[Serial Number]</Original><FunctionCall Name="="><Identifier Name="InventoryList.SerialNumber" Index="0"/><Identifier Name="ImportTest.Serial Number" Index="1"/></FunctionCall></Expression></WhereCondition></Data><Statements><Action Name="SetLocalVar"><Argument Name="Name">IsMatch</Argument><ExpressionArgument Name="Value"><Expression><Original>1</Original><IntegerLiteral Value="1"/></Expression></ExpressionArgument></Action></Statements></LookUpRecord><ConditionalBlock><If><Condition><Expression><Original>[IsMatch]=0</Original><FunctionCall Name="="><Identifier Name="IsMatch" Index="0"/><IntegerLiteral Value="0" Index="1"/></FunctionCall></Expression></Condition><Statements><CreateRecord><Data><Reference>InventoryList</Reference></Data><Statements><Action Name="SetField"><Argument Name="Field">InventoryList.BuildingName</Argument><ExpressionArgument Name="Value"><Expression><Original>1</Original><IntegerLiteral Value="1"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.SerialNumber</Argument><ExpressionArgument Name="Value"><Expression><Original>[ImportTest].[Serial Number]</Original><Identifier Name="ImportTest.Serial Number"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.Model</Argument><ExpressionArgument Name="Value"><Expression><Original>8</Original><IntegerLiteral Value="8"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.RoomDescription</Argument><ExpressionArgument Name="Value"><Expression><Original>1</Original><IntegerLiteral Value="1"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.Manufacturer</Argument><ExpressionArgument Name="Value"><Expression><Original>1</Original><IntegerLiteral Value="1"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.DeviceName</Argument><ExpressionArgument Name="Value"><Expression><Original>[ImportTest].[Device Name]</Original><Identifier Name="ImportTest.Device Name"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.ImagePackage</Argument><ExpressionArgument Name="Value"><Expression><Original>[ImportTest].[Image Package]</Original><Identifier Name="ImportTest.Image Package"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.NeedsVerification</Argument><ExpressionArgument Name="Value"><Expression><Original>[ImportTest].[Needs Verification]</Original><Identifier Name="ImportTest.Needs Verification"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.NewLocation</Argument><ExpressionArgument Name="Value"><Expression><Original>[ImportTest].[New Location]</Original><Identifier Name="ImportTest.New Location"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.OneOffs</Argument><ExpressionArgument Name="Value"><Expression><Original>[ImportTest].[One Offs]</Original><Identifier Name="ImportTest.One Offs"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.PurchasedDate</Argument><ExpressionArgument Name="Value"><Expression><Original>[ImportTest].[Purchased Date]</Original><Identifier Name="ImportTest.Purchased Date"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.Retired</Argument><ExpressionArgument Name="Value"><Expression><Original>[ImportTest].[Retired]</Original><Identifier Name="ImportTest.Retired"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.Software1</Argument><ExpressionArgument Name="Value"><Expression><Original>67</Original><IntegerLiteral Value="67"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.Software2</Argument><ExpressionArgument Name="Value"><Expression><Original>67</Original><IntegerLiteral Value="67"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.Software3</Argument><ExpressionArgument Name="Value"><Expression><Original>67</Original><IntegerLiteral Value="67"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.Software4</Argument><ExpressionArgument Name="Value"><Expression><Original>67</Original><IntegerLiteral Value="67"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.Software5</Argument><ExpressionArgument Name="Value"><Expression><Original>67</Original><IntegerLiteral Value="67"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.Staff-Student</Argument><ExpressionArgument Name="Value"><Expression><Original>[ImportTest].[Staff-Student]</Original><Identifier Name="ImportTest.Staff-Student"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.Swap</Argument><ExpressionArgument Name="Value"><Expression><Original>[ImportTest].[Swap]</Original><Identifier Name="ImportTest.Swap"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.TagNumber</Argument><ExpressionArgument Name="Value"><Expression><Original>[ImportTest].[Tag Number]</Original><Identifier Name="ImportTest.Tag Number"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.TopUser</Argument><ExpressionArgument Name="Value"><Expression><Original>[ImportTest].[Top User]</Original><Identifier Name="ImportTest.Top User"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.Warranty</Argument><ExpressionArgument Name="Value"><Expression><Original>[ImportTest].[Warranty]</Original><Identifier Name="ImportTest.Warranty"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.Comments</Argument><ExpressionArgument Name="Value"><Expression><Original>"Test"</Original><StringLiteral Value="Test"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.CreatedBy</Argument><ExpressionArgument Name="Value"><Expression><Original>"Test"</Original><StringLiteral Value="Test"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">InventoryList.UpdatedBy</Argument><ExpressionArgument Name="Value"><Expression><Original>""</Original><StringLiteral Value=""/></Expression></ExpressionArgument></Action></Statements></CreateRecord></Statements></If></ConditionalBlock></Statements></ForEachRecord></Statements></DataMacro></DataMacros>
Current On Update macro for InventoryList Table (currently is stopped so as to not cause issues and to not overload my AuditTrail table while everything is in development. This macro was tested with multiple people using the database at once and works like a charm).
<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<DataMacros xmlns="http://schemas.microsoft.com/office/accessservices/2010/12/application"><DataMacro Event="AfterUpdate"><Statements><Comment>Macro is stopped to not overload AuditTrail during changes made to initial data.</Comment><Action Name="StopMacro"/><Comment>Save the Old values</Comment><CreateRecord><Data><Reference>AuditTrail</Reference></Data><Statements><Action Name="SetField"><Argument Name="Field">AuditTrail.OldNew</Argument><ExpressionArgument Name="Value"><Expression><Original>"Old"</Original><StringLiteral Value="Old"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.RecordID</Argument><ExpressionArgument Name="Value"><Expression><Original>[InventoryList].[ID]</Original><Identifier Name="InventoryList.ID"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.Timestamp</Argument><ExpressionArgument Name="Value"><Expression><Original>Now()</Original><FunctionCall Name="Now"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.ChangedBy</Argument><ExpressionArgument Name="Value"><Expression><Original>[InventoryList].[UpdatedBy]</Original><Identifier Name="InventoryList.UpdatedBy"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.BuildingName</Argument><ExpressionArgument Name="Value"><Expression><Original>[Old].[BuildingName]</Original><Identifier Name="Old.BuildingName"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.RoomDescription</Argument><ExpressionArgument Name="Value"><Expression><Original>[Old].[RoomDescription]</Original><Identifier Name="Old.RoomDescription"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.Manufacturer</Argument><ExpressionArgument Name="Value"><Expression><Original>[Old].[Manufacturer]</Original><Identifier Name="Old.Manufacturer"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.Model</Argument><ExpressionArgument Name="Value"><Expression><Original>[Old].[Model]</Original><Identifier Name="Old.Model"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.DeviceName</Argument><ExpressionArgument Name="Value"><Expression><Original>[Old].[DeviceName]</Original><Identifier Name="Old.DeviceName"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.TopUser</Argument><ExpressionArgument Name="Value"><Expression><Original>[Old].[TopUser]</Original><Identifier Name="Old.TopUser"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.Staff-Student</Argument><ExpressionArgument Name="Value"><Expression><Original>[Old].[Staff-Student]</Original><Identifier Name="Old.Staff-Student"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.SerialNumber</Argument><ExpressionArgument Name="Value"><Expression><Original>[Old].[SerialNumber]</Original><Identifier Name="Old.SerialNumber"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.TagNumber</Argument><ExpressionArgument Name="Value"><Expression><Original>[Old].[TagNumber]</Original><Identifier Name="Old.TagNumber"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.PurchasedDate</Argument><ExpressionArgument Name="Value"><Expression><Original>[Old].[PurchasedDate]</Original><Identifier Name="Old.PurchasedDate"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.Warranty</Argument><ExpressionArgument Name="Value"><Expression><Original>[Old].[Warranty]</Original><Identifier Name="Old.Warranty"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.ImagePackage</Argument><ExpressionArgument Name="Value"><Expression><Original>[Old].[ImagePackage]</Original><Identifier Name="Old.ImagePackage"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.Swap</Argument><ExpressionArgument Name="Value"><Expression><Original>[Old].[Swap]</Original><Identifier Name="Old.Swap"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.NewLocation</Argument><ExpressionArgument Name="Value"><Expression><Original>[Old].[NewLocation]</Original><Identifier Name="Old.NewLocation"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.Retired</Argument><ExpressionArgument Name="Value"><Expression><Original>[Old].[Retired]</Original><Identifier Name="Old.Retired"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.OneOffs</Argument><ExpressionArgument Name="Value"><Expression><Original>[Old].[OneOffs]</Original><Identifier Name="Old.OneOffs"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.Comments</Argument><ExpressionArgument Name="Value"><Expression><Original>[Old].[Comments]</Original><Identifier Name="Old.Comments"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.NeedsVerification</Argument><ExpressionArgument Name="Value"><Expression><Original>[Old].[NeedsVerification]</Original><Identifier Name="Old.NeedsVerification"/></Expression></ExpressionArgument></Action></Statements></CreateRecord><Comment>Save the New values</Comment><CreateRecord><Data><Reference>AuditTrail</Reference></Data><Statements><Action Name="SetField"><Argument Name="Field">AuditTrail.OldNew</Argument><ExpressionArgument Name="Value"><Expression><Original>"New"</Original><StringLiteral Value="New"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.RecordID</Argument><ExpressionArgument Name="Value"><Expression><Original>[InventoryList].[ID]</Original><Identifier Name="InventoryList.ID"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.Timestamp</Argument><ExpressionArgument Name="Value"><Expression><Original>Now()</Original><FunctionCall Name="Now"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.ChangedBy</Argument><ExpressionArgument Name="Value"><Expression><Original>[InventoryList].[UpdatedBy]</Original><Identifier Name="InventoryList.UpdatedBy"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.BuildingName</Argument><ExpressionArgument Name="Value"><Expression><Original>[InventoryList].[BuildingName]</Original><Identifier Name="InventoryList.BuildingName"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.RoomDescription</Argument><ExpressionArgument Name="Value"><Expression><Original>[InventoryList].[RoomDescription]</Original><Identifier Name="InventoryList.RoomDescription"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.Manufacturer</Argument><ExpressionArgument Name="Value"><Expression><Original>[InventoryList].[Manufacturer]</Original><Identifier Name="InventoryList.Manufacturer"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.Model</Argument><ExpressionArgument Name="Value"><Expression><Original>[InventoryList].[Model]</Original><Identifier Name="InventoryList.Model"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.DeviceName</Argument><ExpressionArgument Name="Value"><Expression><Original>[InventoryList].[DeviceName]</Original><Identifier Name="InventoryList.DeviceName"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.TopUser</Argument><ExpressionArgument Name="Value"><Expression><Original>[InventoryList].[TopUser]</Original><Identifier Name="InventoryList.TopUser"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.Staff-Student</Argument><ExpressionArgument Name="Value"><Expression><Original>[InventoryList].[Staff-Student]</Original><Identifier Name="InventoryList.Staff-Student"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.SerialNumber</Argument><ExpressionArgument Name="Value"><Expression><Original>[InventoryList].[SerialNumber]</Original><Identifier Name="InventoryList.SerialNumber"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.TagNumber</Argument><ExpressionArgument Name="Value"><Expression><Original>[InventoryList].[TagNumber]</Original><Identifier Name="InventoryList.TagNumber"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.PurchasedDate</Argument><ExpressionArgument Name="Value"><Expression><Original>[InventoryList].[PurchasedDate]</Original><Identifier Name="InventoryList.PurchasedDate"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.Warranty</Argument><ExpressionArgument Name="Value"><Expression><Original>[InventoryList].[Warranty]</Original><Identifier Name="InventoryList.Warranty"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.ImagePackage</Argument><ExpressionArgument Name="Value"><Expression><Original>[InventoryList].[ImagePackage]</Original><Identifier Name="InventoryList.ImagePackage"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.Swap</Argument><ExpressionArgument Name="Value"><Expression><Original>[InventoryList].[Swap]</Original><Identifier Name="InventoryList.Swap"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.NewLocation</Argument><ExpressionArgument Name="Value"><Expression><Original>[InventoryList].[NewLocation]</Original><Identifier Name="InventoryList.NewLocation"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.Retired</Argument><ExpressionArgument Name="Value"><Expression><Original>[InventoryList].[Retired]</Original><Identifier Name="InventoryList.Retired"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.OneOffs</Argument><ExpressionArgument Name="Value"><Expression><Original>[InventoryList].[OneOffs]</Original><Identifier Name="InventoryList.OneOffs"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.Comments</Argument><ExpressionArgument Name="Value"><Expression><Original>[InventoryList].[Comments]</Original><Identifier Name="InventoryList.Comments"/></Expression></ExpressionArgument></Action><Action Name="SetField"><Argument Name="Field">AuditTrail.NeedsVerification</Argument><ExpressionArgument Name="Value"><Expression><Original>[InventoryList].[NeedsVerification]</Original><Identifier Name="InventoryList.NeedsVerification"/></Expression></ExpressionArgument></Action></Statements></CreateRecord></Statements></DataMacro></DataMacros>
After checking the Access web app package, I've identified what the issues was. You currently have a Default Value property assigned to each of the Software lookup fields (1-5) in the InventoryList table. I removed those default values for each of those fields. I then put in some sample dummy data into the related tables. Your button on the List view is currently set to run the ImportMacro2 data macro. When I run that now, the macro completes without error and the data is inserted into InventoryList. You can't use N/A as default values because those are lookup fields that only accept IDs (numbers).
Related
well I have this code in a view
<Picker id="picker1" selectionIndicator="true" class="picker">
<!-- Picker shorthand notation -->
<Column id="column1" class="column">
<Row title="option1" />
<Row title="option2" />
<Row title="option3" />
</Column>
</Picker>
and I have been trying to change the rows on the controller, since I receive different options from the server, lets say for example:
( option4, option5, option6 )
I tried adding a row to the picker like this:
$.column1.addRow(Ti.UI.createPickerRow({title:'option4'}));
and had no success too, looking through the forums on appcelerator it wasn't possible before titanium SDK 5.1.0 GA to dynamically update the picker, but on another topic I've read that it is possible to do it but you have to reload the picker, so I tried it, but no success
var picker = $.picker1;
var column = $.column1;
column.addRow(Ti.UI.createPickerRow({title:'option4'}));
picker.reloadColumn(column);
how should be the right way to do it? adding a row and removing others, that is my question.
I am testing on an iphone(9+) and android(5+), using the Titanium SDK 5.1.2GA.
Solved, it was just a mistype, sorry, but you need to reload the column, or else it will not work.
var picker = $.picker1;
var column = $.column1;
column.addRow(Ti.UI.createPickerRow({title:'option4'}));
picker.reloadColumn(column);
I have one simple question.
My problem is:
Is there are any free extensions that could turn "Enable Qty Increments" and "Qty Increments" from global scope to store view?
Also I have found this question inventory settings
It's have some kind of answer, but I need to confirm this.
If there are no free extension that could fulfill my needs, do I need to write my own extension (as answer in previous link says) or there is an easy way to change scope from global to store view. ?
My Magento version is CE 1.9.1.0
What you could do to achieve the same thing is create a new product text attribute called pack_size, give it a per store view scope, then set the order quantity against it per product, per store view.
Then, in your addtocart.phtml file, here;
app/design/frontend/XXX/YYY/template/catalog/product/view/addtocart.phtml
Where XXX YYY is the name of your theme, and replace the quantity input box with;
<?php $pack = $_product->getData('pack_size'); ?>
<?php if(($pack == 1) || (!$pack)) { ?>
<input type="text" name="qty" id="qty" maxlength="4" value="1" />
<?php } else { ?>
<select name="qty" id="qty" maxlength="12">
<?php
$countme = 1;
while ($countme < 101) {
echo '<option value="'.($pack*$countme).'">'.($pack*$countme).'</option>';
$countme++; } ?>
</select>
Now if the value of pack_offer is set and greater than 1, the user will only be able to choose a multiple of that qty.
Depending on your theme, you may also need to implement this in the cart page.
This is seems weird as when I check Mage model's customer class the method is there getPasswordConfirmation(), but when I check my extension files there is no any trace of such method or getConfirmation() method. But I get the above error as I try to place the order. Can you give me any suggestions or guesses? Help is appreciated. Thanks.
extension
It could be a JavaScript validation message generated from validation.js file:
In your validation.js file (probably around line 529) look for:
['validate-cpassword', 'Please make sure your passwords match.', function(v) {
If you don't want this validation just remove validate-cpassword (pay attention to letter c in cpassword!) from HTML class definition of your form in .phtml file (should be billing.phtml). In this line:
<input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
I've followed this Tutorial to add a custom field to the article content type and I was successful to make a new one with adding the following code:
In File : root/administrator/components/com_content/models/forms/article.xml
Code :
<field name="newText" type="editor" class="inputbox"
label="COM_CONTENT_FIELD_ARTICLETEXT_LABEL"
description="COM_CONTENT_FIELD_ARTICLETEXT_DESC"
filter="ContentHelper::filterText" buttons="true" />
In File : root/administrator/components/com_content/views/article/tmpl/edit.php
Code :
//Our new textbox
<div class="clr"></div>
<label>Article Text - New Text</label>
<div class="clr"></div>
<?php echo $this->form->getInput('newText'); ?>
and altered Database to add a new column for that new field.
ALTER TABLE 'j_content' ADD 'newText' VARCHAR( 255 ) NOT NULL;
On Article posting the data is successfully getting stored in Database.
The new custom field is visible when I'm posting a brand new article. But when I'm editing/updating the same new post, that newly added field is missing.
Is there a way to get this field even when we are editing the post/article.
Please, never overwrite core files or change the core database! This is not a good tutorial because it is not update-safe.
If you need additional fields for your content items, use a special core extension for this instead.
I recommend this one:
http://fieldsattach.com/. This method is update-safe.
I wonder if there is a way to add a Warning/Advisory or Terms & Conditions (preferably) to a category or a landing page to warn users about adult content. On the shop I'm working on there is an "Adult Section" Category for Erotic Toys, Lingerie, cosplay, etc. and I need to warn users about such content before they access the section in case they're less than 18.
I've searched the web and only found paid extensions which I cannot afford. Does anyone know how to do this?
I'm using Magento CE 1.7.
Thanks,
EDIT:
Ok, so I've been trying to figure out how to do this and I just figured that the best way to do it would be to just create a Category Landing Page and adding a java script for T&C redirect to the page I want it to.
This is the code I would use for the Category Landing Page with blank content would be this.
<?php $_categories = $this->getCurrentChildCategories() ?>
<?php $_collectionSize = $_categories->count() ?>
<div>
<?php $i=0; foreach ($_categories as $_category): ?>
<?php
$layer = Mage::getSingleton(‘catalog/layer’);
$layer->setCurrentCategory(Mage::getModel(‘catalog/category’)->load($_category->getId()));
$helper = Mage::helper(‘catalog/category’);
?>
Then I found a code snippet that would redirect the user to a page of my liking after clicking accept but I'm not sure how to implement it and/or if this is the best choice. Here's the code.
<form action="url-to-go-to" method="GET" onsubmit="return checkCheckBox(this)">
I accept: <input type="checkbox" value="0" name="agree">
<input type="submit" value="Continue">
<input type="button" value="Exit" onclick="document.location.href='BACKTOWHAT.html';">
</form>
<script type="text/javascript">
<!--
function checkCheckBox(f){
if (f.agree.checked == false )
{
alert("Please tick the box to continue");
return false;
} else
return true;
}
-->
</script>
Now I was thinking that it would be best to just create a simple CMS page and point the category on the top menu to that page and once they have agreed and clicked on continue, they could be taken to the actual category by simply pointing the 'onclick' to the URL of the actual category.
Not sure if this is the best way but it's the only way I could come up. The other way I thought of would've required me to take the "agreements" during checkout that already comes with magento and make an extension that would allow me to place it on any page and call the "Agreement ID" from the Sales/Terms and Conditions tab but I don't know how to actually do that, it was just a thought.
If anyone has a better solution, I'd be happy to hear it.
I would add some sort of JavaScript that shows a div over the top of the whole page, that will create a session cookie when you accept to watch the category. Otherwise, make a back() in the history navigation. This way you don't need another page, just JS.
On another note, could you please post the extensions you found that do this?