Forum Discussion
Hi,
I think i did that:
GetCBOProfileSabreProfileID(CBOSabreID0);
Thanks,
Kim
Nope. That passes in some unknown identifier CBOSabreID0. You want to pass in a string. So, it needs to read
GetCBOProfileSabreProfileID('CBOSabreID0');
Note the inclusion of the quotes indicating that what you're passing in is a string. Again, the non-strict typing of JavaScript got you... you can create identifiers on the fly just simply by using them. So, you had created an identifier of CBOSabreID0 that was empty and didn't actually contain the desired string.
EDIT: Sorry, not JavaScript... DelphiScript. But the same thing applies. DelphiScript is not strongly typed either so it allows you do do some odd things with creating variables that can contain different values.
- kimmatsumoto8 years agoContributor
GetCBOProfileSabreProfileID('CBOSabreID0');I tried the above but results was the same.
- kimmatsumoto8 years agoContributor
This is a similar procedure which works:
procedure Verify_Traveler_SabreProfileID(var1);
var
page, obj;
begin
page := Sys.Browser('*').Page(EnvironmentSettings2.GetServerURL + '*');
obj := GetNativeWebObject(page, 'id', 'sabreProfileID');
obj.ScrollIntoView(false);
//Verify Sabre Profile ID
case var1 of
'CBOSabreID0':
begin
aqObject.CheckProperty(obj, 'innerText', cmpEqual, ProjectSuite.Variables.CBOSabreID0);
end;end;
end;
Used as: Verify_Traveler_SabreProfileID(CBOSabreID0);
- tristaanogre8 years agoEsteemed Contributor
Breaking it down to just the case statement, this works:
function GetCBOProfileSabreProfileID(varsp1); begin //Assign var1 for the persistent variable case varsp1 of 'CBOSabreID0': begin log.message('Ths is the case'); end; end; end; procedure test; begin GetCBOProfileSabreProfileID('CBOSabreID0'); end;So, this tells me the problem is not in the case statement but in some of the other processing you're doing. Looking at your code, it's really, honestly, difficult to follow. You're reassinging "obj" to something else a couple of different times, you have this variable CBOSabreProfileIDInput that seems to come out of no where (there's no declaration of what it is), so... I'm not entirely sure what's going on.
My suspicion is that varsp1, while you may be passing a value into it, somehow it's getting changed or reset or otherwise processed differently somewhere and that's overriding what you're expecting. So, try and trace back what your variable values are.
If you want more assistance, we're going to need to see a bit more in the way of context, perhaps the full unit of code that all this sits in.