Is there something I'm doing wrong to pick up this error? - ti-basic

I am new to Ti-basic, and I am trying to code it. I'm trying to make this 'special type of input' program. It is kind of like input, but it will show the word as it is being pressed (and there is no need to put in alpha)
Here is the code so far that I believe is pertaining to the error
:{41,42,43,51,52,53,54,55,61,62,63,64,65,71,72,73,74,75,81,82,83,84,85,91,92,93,94,102,103,103}→∟KEYS
:"ABCDEFGHIJKLMNOPQRSTUVWXYZθ :?"→Str7
:0→K
:""→Str1
:
:Repeat K=105
:getKey→K
:If max(∟KEYS-K)
:prgmFINDIND
:.........
:End
Inside prgmFINDIND, This is the code
:1+sum(not(cumSum(∟KEYS=K)))→I
://I is used later on in the code. It isn't pertaining to the problem.
I have done some testing with pause on this already, and I found the problem was in the if statement. It returns an 'INVALID DIM' error.
Anybody know what's wrong?

In this part (edited a bit)
Repeat K=105
getKey->K
If max(|LKEYS=K
prgmFINDIND
Str1+sub(Str7,I,1->Str1
End
prgmFINDIND is only called if the key that was pressed is in the list, otherwise the index I is not changed (and possibly implicitly zero, or whatever other value that was left there).
Pressing GOTO on the INVALID DIM actually goes to Str1+sub(Str7,I,1->Str1, indicating that a bad index was used to index into Str7.
It could be fixed by using an If/Then block, which can cover more than one statement:
Repeat K=105
getKey->K
If max(|LKEYS=K
Then
prgmFINDIND
Str1+sub(Str7,I,1)->Str1
End
End

Related

How to use formula CASE WHEN on Netsuite Oracle?

Hi Can someone help me with the Saved Search: So I’m trying to create a formula(numeric) that would say:
CASE WHEN {internalid} = ‘32319’ THEN 1 ELSE 0 END
— didn’t work it didn’t even show on the description
I also tried:
CASE {internalid} WHEN 32319 THEN 1 ELSE 0 END — also didn’t work and didn’t show on the description.
Not sure if perhaps using formula on my saved search is disabled on my end if so how can I know or check? Or maybe I did not use to correct syntax for the CASE WHEN? The formula is also grayed out(highlighted).
I managed to find a solution. As it turns out I just needed to put a value of 1 on the textbox for Value to validate the CASE WHEN Statement. Also whether there's a single quote for the numbers or in this case without a single quote, it still worked.
Either of those forms should work but your screen shots show a Formula(Text) rather than Formula(Numeric)

How do I remove the 'Done' message after my program has executed?

I made a program that is similar to clearing RAM. However, it always leaves a "Done" message followed by a dotted line after being executed. In addition, if you scroll up, you can see that the program was executed. Is there a way to remove both of these things? If you can't hide the fact that a program was executed, could you suppress the 'Done' message?
I have tried adding ClearHome" and " as the last line of my program, and neither stops the Done message from displaying.
Bonus points if your solution can be contained within the original program.
In a separate program, type the following line of code:
AsmPrgmFDCB00AEC9
Then at the end of the original program, type the following line of code:
Asm(prgmPROGRAMNAME
It is recommended that you test this out first with all programs archived, just running the above line of code alone, in case it fails. Hex codes like that one have been known to fail, and sometimes clears the RAM.
You can also try these other hex codes, but always keep in mind the warning above. My RAM has been cleared by this before, so use caution:
http://tibasicdev.wikidot.com/hexcodes
This works on TI 83 and 84, may be different with other calculator types.
EDIT:
I found a way to do this without an external program, and is much simpler.
Just add the following line of code to the end of your program:
Output(1,1," //no space, just a quote
You may or may not have to add ClrHome before that line of code.
This should prevent the Done message from appearing at the end.
Hope this helps!
Put an empty string at the end of your program, so your last line looks like this:
""
Or this
"
The empty string is stored to ans and will be displayed as a blank line rather than the Done message.
There is also an assembly hexcode to do this without leaving the blank line at the top:
FDCB00AEC9
When run at the end of the program using one of the various methods of running assembly, it will leave you with a blank, fully operational homescreen.
Outputting an empty string will prevent the Done message and also preserve Ans, in case a calling program is expecting to use it.
Output(Y,X,"")
See http://tibasicdev.wikidot.com/output for more details on Output(.
In your situation, run Clear Entries (found under Mem), then scroll up so that the Done message is selected and press Clear to get rid of it.

Cannot convert Group Description to String Variable

I have the following code:
Set objHoldGroup = GetObject("LDAP://" & objGroup)
strGroupDesc = (objHoldGroup.Description)
WScript.Echo(strGroupDesc)
The variable strGroupDesc returns nothing when echoed. I can output the description directly but I need it for further processing. Thoughts?
Explanation: Apparently your script sets Option Explicit (good), which you didn't tell us about (bad). This option makes defining variables before you can use them mandatory (good). Normally that would raise an "undefined variable" error, though. Since that doesn't seem to happen with your code, you seem to also have an On Error Resume Next somewhere in your code (very bad), which, again, you chose to keep quiet about (bad).
Next time please don't omit parts of your code that are vital for troubleshooting the problem. And don't use On Error Resume Next.
Issue found: I forgot to Dim strGroupDesc.

Type mismatch error while reading lotus notes document in vb6

Am trying to read the lotus notes document using VB6.I can able to read the values of the but suddenly type mismatch error is throwed.When i reintialise the vb6 variable it works but stops after certain point.
ex; address field in lotus notes
lsaddress=ImsField(doc.address)
private function ImsField(pValue)
ImsField=pValue(0)
end function
Like this I am reading the remaining fields but at certain point the runtime error "13" type mismatch error throwed.
I have to manually reintialize by
set doc=view.getdocumentbykey(doclist)
The type mismatch error occurs for a certain field. The issue should be a data type incompatibility. Try to figure out which field causes the error.
Use GetItemValue() instead of short notation for accessing fields and don't use ImsField():
lsaddress=doc.GetItemValue("address")(0)
The type mismatch is occurring because you are encountering a case where pValue is not an array. That will occur when you attempt to reference a NotesItem that does not exist. I.e., doc.MissingItem.
You should not use the shorthand notation doc.itemName. It is convenient, but it leads to sloppy coding. You should use getItemValue as everyone else is suggesting, and also you should check to see if the NotesItem exists. I.e.,
if doc.hasItem("myItem") then
lsaddress=doc.getItemValue("myItem")(0)
end if
Notes and Domino are schema-less. There are no data integrity checks other than what you write yourself. You may think that the item always has to be there, but the truth is that there is nothing that will ever guarantee that, so it is always up to you to write your code so that it doesn't assume anything.
BTW: There are other checks that you might want to perform besides just whether or not the field exists. You might want to check the field's type as well, but to do that requires going one more level up the object chain and using getFirstItem instead of getItemValue, which I'm not going to get into here. And the reason, once again, is that Notes and Domino are schema-less. You might think that a given item must always be a text list, but all it takes is someone writing sloppy code in an one-time fix-it agent and you could end up having a document in which that item is numeric!
Checking your fields is actually a good reason (sometimes) to encapsulate your field access in a function, much like the way you have attempted to do. The reason I added "sometimes" above is that your code's behavior for a missing field isn't necessarily always going to be the same, but for cases where you just want to return a default value when the field doesn't exist you can use something like this:
lsaddress ImsField("address","")
private function ImsField(fieldName,defaultValue)
if doc.hasItem(fieldName) then
lsaddress=doc.getItemValue(fieldName)(0)
else
lsaddress=defaultValue
end if
end function
Type mismatch comes,
When you try to set values from one kind of datatype variable to different datatype of another variable.
Eg:-
dim x as String
Dim z as variant
z= Split("Test:XXX",":")
x=z
The above will through the error what you mentioned.
So check the below code...
lsaddress = ImsField(doc.address)
What is the datatype of lsaddress?
What is the return type of ImsField(doc.address)?
If the above function parameter is a string, then you should pass the parameter like (doc.address(0))

"Compile Error: Only Comments may appear after End Sub, End Function.." Access 2010 VBA

I am creating a form and I have created my first function in the VBA window. The function creates Buttons. After I type anything after the 'End function' I get an error- "Only comments appear after .." What's wrong? Am I putting the function in the wrong area?
Here is my code:
Option Compare Database
Option Explicit
Function MainMenuOptions()
Dim frm As String
frm = "Main"
Dim SCFormB As Control
Dim SCSearchB As Control
Dim SCReportB As Control
Set SCFormB = CreateControl(frm, acOptionButton, , , , 0.5, 0.6, 1.5, 0.55)
Set SCSearchB = CreateControl(frm, acOptionButton, , , , 0.5, 1.5, 1.5, 0.55)
Set SCReportB = CreateControl(frm, acOptionButton, , , , 0.5, 2.4, 1.5, 0.55)
End Function
I have recently had this problem. I'm creating a new Shares/Derivatives trade and management application, and I'm making awesome progress on creating a form, when at one point, I starting getting this error for ALL of the _Click() handlers for the controls on the form. But, it was not happening for an _Enter() handler for one of the fields on the form. There was no extraneous text after any of the 'End' statements - at all! I discovered that, somehow, the incorrect LINE ENDINGS had made their way onto the ends of the 'End' statements.
The Fix: go to the end of each of your 'End' statements, hit DELETE until the next Sub statement comes up to the cursor (i.e., you now have the start of the next procedure on the same line as the previous proc's End statement), then hit ENTER to put the next Sub statement back on it's own line. This will ensure that you have the correct CR/LF (or whatever is required of that editor/compiler) at the ends of each of your event handlers.
Apparently, you have extra code in your module which is outside of a function or sub. In the VBA editor select debug -> compile and it should highlight the offending code which you can remove or revise.
FYI: CreateControl uses twips(one 1440th of an inch) for left, top, width, and height. You may want to multiply the numbers you are using by about 1440.
If you check the Microsoft Office Dev Center for this error message you get the following explanation:
You placed executable code outside a procedure. Any nondeclarative
lines outside a procedure must begin with a comment delimiter (').
Declarative statements must appear before the first procedure
declaration. Comments are ignored when the code executes.
This means that the type of code you can write outside a Sub or Function is limited.
I had this error, and the solution was simple, however VBA's debugger threw me off the scent for a while. I had extra code after "End Sub" that needed deleting (copy and paste error), however rather than highlighting the extra code after the "End Sub" statement, the debugger highlighted the beginning of the Sub procedure, causing me to think that the error was between the opening statement of the highlighted Sub procedure and the "End Sub" ABOVE it, when in fact the error was after the "End Sub" of the highlighted sub procedure, so I needed to look well BELOW the highlighted text. So, in effect, VBA highlighted the beginning of a sub-procedure that was entirely fine, rather than the issue immediately after it.
It's like someone leaving a bag of trash immediately outside your front door so you walk into the trash as soon as you walk through the door, and then you say "Huh, I need to move the trash" while pointing at the door.
I had this issue as well, but I didn't have any code outside of my subs. I was getting the error after Access would generate a piece of code (I was trying to add code for the NoData state of my report). When I put a dummy comment below the End Sub that was having the issue it fixed the issue, at least for the last three compiles I have done.

Resources