problem got when use writecases command

Discussions about CSEntry
Post Reply
Jing Liu
Posts: 42
Joined: July 1st, 2015, 3:19 am

problem got when use writecases command

Post by Jing Liu »

Hi,

I got error message "ERROR: Variable(s) length do not agree with dictionary id-length near line 19 in ENDMINUTE procedure", but i have checked the length, they are the same (47). I attached the screen print here.

did i calculate it wrong?

best

Jing
Attachments
problem in using writecases command.docx
(100.72 KiB) Downloaded 323 times
Jing Liu
Posts: 42
Joined: July 1st, 2015, 3:19 am

Re: problem got when use writecases command

Post by Jing Liu »

Hi,

I tried another way, trying to load information stored in memory (not a field) but then i got different error message "ERROR: Invalid argument for LoadCase/WriteCase function near line 33 in END_QUEST_FORM procedure".

PROC GLOBAL
{Array for RS woman information}
array numeric RSWCandID(30); {Array of roster ID for valid RSI woman candidates}
array alpha(50) RSWCandName(30); {Array of name for valid RSI woman candidates}
array RSWCandAge(30); {Array of age for valid RSI woman candidates}
array RSWCandSex(30); {Array of sex for valid RSI woman candidates}
numeric RSWseq; {Sequencial position of RSI woman selected}
numeric RSWID; {Roster ID of RSI woman}
alpha(40) RSWName; {Name of RSI woman}
numeric RSWAge; {Age of RSI women}
numeric RSWSex; {Sex of RSI women}

PROC END_QUEST_FORM

{Selcted RSI woman}
i = 1;
n = 0;
while i <= HD05 do
if HR04(i) >= 15 and HR03(i)=2 then
n = n + 1;
RSWCandID(n) = i;
RSWCandName(n) = Name(i);
RSWCandAge(n) = HR04(i);
RSWCandSex(n) = HR03(i);
endif;
i = i + 1;
enddo;

if n=0 then
endlevel; // No RSI women candidate, end level
elseif n>0 then
if (n*SRANDOMSEED)-int(n*SRANDOMSEED)=0 then
RSWseq = int(n*SRANDOMSEED);
elseif (n*SRANDOMSEED)-int(n*SRANDOMSEED)>0 then
RSWseq = int(n*SRANDOMSEED)+1;
endif;
endif;
RSWID = RSWCandID(RSWseq);
RSWName = RSWCandName(RSWseq);
RSWAge = RSWCandAge(RSWseq);
RSWSex = RSWCandSex(RSWseq);

writecase(RSIINFOEXPORT, HHID,RSWID,RSWName,RSWAge,RSWSex);

best

Jing
Jing Liu
Posts: 42
Joined: July 1st, 2015, 3:19 am

Re: problem got when use writecases command

Post by Jing Liu »

Hi,

This problem is solved now. Thanks a lot for the help from Josh, Trevor and Greg!

I leave the code here in case someone else need help in the future. HHID_RSIINFO, RSWID, RSWNAME, RSWAGE and RSWSEX are fields from external dictionary but not variables defined in the main dictionary!

best

Jing


PROC END_QUEST_FORM

{Selcted RSI woman}
i = 1;
n = 0;
while i <= HD05 do
if HR04(i) >= 15 and HR03(i)=2 then
n = n + 1;
RSWCandID(n) = i;
RSWCandName(n) = Name(i);
RSWCandAge(n) = HR04(i);
RSWCandSex(n) = HR03(i);
endif;
i = i + 1;
enddo;

if n=0 then
endlevel; // No RSI women candidate, end level
elseif n>0 then
if (n*SRANDOMSEED)-int(n*SRANDOMSEED)=0 then
RSWseq = int(n*SRANDOMSEED);
elseif (n*SRANDOMSEED)-int(n*SRANDOMSEED)>0 then
RSWseq = int(n*SRANDOMSEED)+1;
endif;
endif;
RSWID = RSWCandID(RSWseq);
RSWName = RSWCandName(RSWseq);
RSWAge = RSWCandAge(RSWseq);
RSWSex = RSWCandSex(RSWseq);

// confirm the information of RS woman.
errmsg("The selected woman is %s, %s, %d years old, Roster ID is %d", strip(RSWName), getlabel(RSWSex,RSWSex), RSWAge, RSWID);

{Export RS woman information to external file}
HHID_RSIINFO = HHID; // should be added here, instead of passing writecase the ID from your main dictionary, pass it the ID from your external dictionary. otherwise, error!
writecase(RSIINFOEXPORT, HHID_RSIINFO);
Post Reply